Last active
December 7, 2017 18:50
-
-
Save jimblandy/c2bd7d98400f2fb242e5f210e2c8af21 to your computer and use it in GitHub Desktop.
Top-level `let` versus `var`
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
<body> | |
<script src="foo1.js"></script> | |
<script src="foo2.js"></script> | |
<script> | |
console.log('var1: ', var1); | |
console.log('var2: ', var2); | |
console.log('window.var1: ', window.var1); | |
console.log('window.var2: ', window.var2); | |
</script> | |
</body> |
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
var var1 = 'var1 from foo1.js'; | |
let var2 = 'var2 from foo1.js'; |
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
var var1 = 'var1 from foo2.js'; | |
let var2 = 'var2 from foo2.js'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment