Skip to content

Instantly share code, notes, and snippets.

@selmanon
Last active August 27, 2016 13:24
Show Gist options
  • Save selmanon/b386a19af520f8c46c96f21867f3a2d9 to your computer and use it in GitHub Desktop.
Save selmanon/b386a19af520f8c46c96f21867f3a2d9 to your computer and use it in GitHub Desktop.
https://repl.it/CuhM/0 created by selmanon
var level1 = "a";
function outer() {
var level2 = "b";
function middle() {
var level3 = "c";
// the function 'inner' can access all variables in the outer scopes
function inner() {
document.write (level1 + level2 + level3);
}
inner();
}
middle();
}
outer();
Native Browser JavaScript
>>> abc
=> undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment