Skip to content

Instantly share code, notes, and snippets.

@zaius
Created December 10, 2014 01:41
Show Gist options
  • Save zaius/9bf7b81e2b7980e8bea2 to your computer and use it in GitHub Desktop.
Save zaius/9bf7b81e2b7980e8bea2 to your computer and use it in GitHub Desktop.
Javascript var
var foo = 1;
var bar = 1;
(function() {
console.log(foo, bar)
var bar = 2
foo = 2
console.log(foo, bar)
})()
// Outputs:
// 1, undefined
// 2, 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment