Skip to content

Instantly share code, notes, and snippets.

@mstan
Created April 18, 2019 21:58
Show Gist options
  • Select an option

  • Save mstan/387017658998cb045a33ea54b3bb387f to your computer and use it in GitHub Desktop.

Select an option

Save mstan/387017658998cb045a33ea54b3bb387f to your computer and use it in GitHub Desktop.
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