Created
June 20, 2021 03:31
-
-
Save pszponder/585f7f2b3000e51ffe2508b2436a2093 to your computer and use it in GitHub Desktop.
This file contains 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 does not follow block scoping | |
{ | |
var a = 1; | |
console.log(a); // 1 | |
} | |
console.log(a); // 1 | |
{ | |
{ | |
var b = 2; | |
console.log(b); // 2 | |
} | |
// 2 (if b was declared using let or const, you would get a ReferenceError) | |
console.log(b); | |
} | |
console.log(b); // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment