Skip to content

Instantly share code, notes, and snippets.

@apipkin
Created February 3, 2010 16:02
Show Gist options
  • Save apipkin/293707 to your computer and use it in GitHub Desktop.
Save apipkin/293707 to your computer and use it in GitHub Desktop.
var foo = 'bar';
function DefineVar() {
var foo = 'widget';
}
function UpdateVar() {
foo = 'wobble';
}
alert(foo); // alerts 'bar'
UpdateVar();
alert(foo); // alerts 'wobble';
DefineVar();
alert(foo); // alerts 'wobble';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment