Skip to content

Instantly share code, notes, and snippets.

@deniswolf
Created January 7, 2013 17:31
Show Gist options
  • Select an option

  • Save deniswolf/4476840 to your computer and use it in GitHub Desktop.

Select an option

Save deniswolf/4476840 to your computer and use it in GitHub Desktop.
function topLevel(){
var i = 1;
console.log('Top level i: ',i);
function innerLevel(){
console.log('Inner level i: ',i);
console.log('... because var i was silently declared in the beginning of scope === function');
var i = 2;
console.log('Inner level i after assigment: ', i);
}
innerLevel()
}
topLevel();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment