Skip to content

Instantly share code, notes, and snippets.

@colintoh
Created October 9, 2014 11:22
Show Gist options
  • Save colintoh/bbdd9884736cfbdb22d3 to your computer and use it in GitHub Desktop.
Save colintoh/bbdd9884736cfbdb22d3 to your computer and use it in GitHub Desktop.
Using `let` in loop
var arr = new Array(3);
for (var i = 0; i<arr.length; i++) {
console.log(i); // 0,1,2,3
}
console.log(i); // 3
for(let j = 0; j < arr.length; j++){}
console.log(j); //ReferenceError: j is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment