Skip to content

Instantly share code, notes, and snippets.

@peterbsmyth
Created September 25, 2015 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbsmyth/e7062a84a8824cdd9b8e to your computer and use it in GitHub Desktop.
Save peterbsmyth/e7062a84a8824cdd9b8e to your computer and use it in GitHub Desktop.
let in ES6
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