1. Stop checking array length using [ ].length > 0.
Press enter or click to view image in full size
Noob
Press enter or click to view image in full size
Ninja
2. Stop using single if condition, prefer to write it in one single line
Press enter or click to view image in full size
Noob
Press enter or click to view image in full size
Ninja
3. Stop using if to conditionally add keys in object, prefer de-structuring
Press enter or click to view image in full size
Noob
Press enter or click to view image in full size
Ninja
4. Stop using too many conditions in if , use includes instead
Press enter or click to view image in full size
Noob
Press enter or click to view image in full size
Ninja
5. Prefer using boolean result wherever possible using !!
Press enter or click to view image in full size
Noob
Press enter or click to view image in full size
Ninja
Disclaimer: Aim of this article is to spread awareness about the concepts, like why arr.length is sufficient, why we use !! to get boolean result etc. Off course, I haven’t given reason for the same, it’s up to the reader to do the hard work. Aim of article is not to look clever in front of others.