Created
September 25, 2015 20:08
-
-
Save peterbsmyth/e7062a84a8824cdd9b8e to your computer and use it in GitHub Desktop.
let in ES6
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
if (a < b){ | |
let c = true; | |
} | |
// ES6 introduces block scoping with let, which means that in the example above c is only | |
// available in the if statement vs the example below | |
if (a < b){ | |
var c = true; | |
} | |
// here c is avaiable outside of the if statement, because var is not block-scoped. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment