Created
November 14, 2018 23:11
-
-
Save kselax/d7775192befcc1a256ccb9cbbf7b8335 to your computer and use it in GitHub Desktop.
priority let 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
| { | |
| var x = 1 | |
| { | |
| let x = 2 // SyntaxError: Identifier 'x' has already been declared | |
| { | |
| function f(){ | |
| let x = 10 | |
| { | |
| var x = 20 // SyntaxError: Identifier 'x' has already been declared | |
| { | |
| console.log('fscope3 x = ', x); | |
| } | |
| console.log('fscope2 x = ', x); | |
| } | |
| console.log('fscope1 x = ', x); | |
| } | |
| f() | |
| 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