Created
June 8, 2016 17:25
-
-
Save dphoebus/66046e271489a72594b18d7f63ab83c3 to your computer and use it in GitHub Desktop.
JavaScript Quick Hitters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(fruit === 'apple' || fruit === 'banana' || fruit === 'chikoo'){ | |
doMagic(); | |
} | |
// can be turned into this: | |
if({apple:1,banana:1,chikoo:1}[fruit]){ | |
doMagic(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment