Last active
November 5, 2017 02:21
-
-
Save DmitrySoshnikov/08823dee5bf30f73730d3e4c5b2d3954 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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