Skip to content

Instantly share code, notes, and snippets.

@sri-rang
Created December 25, 2011 15:48
Show Gist options
  • Save sri-rang/1519445 to your computer and use it in GitHub Desktop.
Save sri-rang/1519445 to your computer and use it in GitHub Desktop.
Functional Programming in JavaScript - 3
(function (name) {
console.log(name + " functions can be auto-executed on definition")
})("Anonymous");
console.log("JavaScript provides functional scoping instead of block scoping");
(function () {
if (true) {
var x = true;
console.log("Is 'x' available inside the block? " + x);
}
console.log("Is 'x' available outside the block? " + x);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment