Last active
August 29, 2015 14:09
-
-
Save nulayuhz/113059513eda13bb8adb to your computer and use it in GitHub Desktop.
There is no elseif in JavaScript
This file contains 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 (a) { | |
//...a | |
} else if (b) { | |
//...b | |
} else { | |
//...c | |
} | |
//...is actually: | |
if (a) { | |
// ...a | |
} else { | |
if (b) { | |
//...b | |
} else { | |
//...c | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/getify/You-Dont-Know-JS/blob/master/types%20&%20grammar/ch5.md#else-if-and-optional-blocks