Skip to content

Instantly share code, notes, and snippets.

@almonk
Created November 2, 2012 14:41
Show Gist options
  • Save almonk/4001753 to your computer and use it in GitHub Desktop.
Save almonk/4001753 to your computer and use it in GitHub Desktop.
(function(i) {
'use strict';
console.log(i); // undefined
console.log(bar); // function
console.log(animals); // undefined
console.log('-------------------------');
var i = 2;
var bar = 'cool';
function bar() {
return 'yey';
}
var animals = function foo() {
return 'cats';
};
console.log(i); // 2
console.log(bar); // cool
console.log(animals); // function
console.log(foo); // reference error, foo undefined
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment