Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
Last active November 5, 2017 02:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitrySoshnikov/08823dee5bf30f73730d3e4c5b2d3954 to your computer and use it in GitHub Desktop.
Save DmitrySoshnikov/08823dee5bf30f73730d3e4c5b2d3954 to your computer and use it in GitHub Desktop.
/**
* JavaScript static scope example.
*/
const x = 10;
function print_x() {
console.log(x);
}
function run() {
const x = 20;
print_x(); // 10, not 20
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment