Created
November 14, 2018 23:07
-
-
Save kselax/3c57d357fe935e5dd202201efbb64925 to your computer and use it in GitHub Desktop.
let scope variable can't be break by 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
| { | |
| let x = 1 | |
| { | |
| var x = 2 // SyntaxError: Identifier 'x' has already been declared | |
| { | |
| console.log('scope1 x = ', x); | |
| } | |
| console.log('scope2 x = ', x); | |
| } | |
| console.log('scope3 x = ', x); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment