Created
April 18, 2019 21:58
-
-
Save mstan/387017658998cb045a33ea54b3bb387f 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
| function doSomething() { | |
| if(true) { | |
| let booleanValue = true; | |
| } | |
| console.log(booleanValue); // It'll throw an exception in the compiler because booleanValue doesn't exist out here. | |
| } | |
| function doSomething() { | |
| if(true) { | |
| var booleanValue = true; | |
| } | |
| console.log(booleanValue); // comes out true. booleanValue got escalated up to being inside of doSomething() and not instead of the if() statement | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment