Created
July 15, 2013 01:21
-
-
Save evadne/5996892 to your computer and use it in GitHub Desktop.
Semicolon Jeopardy
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
var something = function () { | |
alert("something destructive."); | |
} | |
((function(){ | |
alert("do it now. :D"); | |
})()); | |
// Function declaration for `something` is underhanded. | |
// It has no terminating semicolon, so the immediately evaluated expression, | |
// which evaluates to `undefined`, is used as a parameter to immediately invoke | |
// the function, whose results will be set to `something`. | |
// This is one of the many reasons why semicolon insertion is bad. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment