Skip to content

Instantly share code, notes, and snippets.

@evadne
Created July 15, 2013 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evadne/5996892 to your computer and use it in GitHub Desktop.
Save evadne/5996892 to your computer and use it in GitHub Desktop.
Semicolon Jeopardy
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