Skip to content

Instantly share code, notes, and snippets.

@Vinay18jan
Created Jun 29, 2020
Embed
What would you like to do?
Local scope example
var foo = "bar";
function bar() {
var foo = "baz";
function baz(foo) {
foo = "bam";
bam = "yay";
}
baz();
}
bar();
console.log(foo); //bar
console.log(bam); //yay
baz(); //reference error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment