Created
October 9, 2014 11:22
-
-
Save colintoh/bbdd9884736cfbdb22d3 to your computer and use it in GitHub Desktop.
Using `let` in loop
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
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