Skip to content

Instantly share code, notes, and snippets.

@hillscottc
Created May 1, 2015 01:29
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 hillscottc/13adce9430b0e6e3b389 to your computer and use it in GitHub Desktop.
Save hillscottc/13adce9430b0e6e3b389 to your computer and use it in GitHub Desktop.
Keep stuff out of global by creating and calling an anon func.
/* Keep stuff out of global by creating and calling an anon func.
*/
(function() {
function square(x) { return x * x; }
var hundred = 100;
console.log(square(hundred));
})();
// → 10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment