Created
January 17, 2016 09:39
-
-
Save ronalddddd/8d3c4e90b45d067d478f to your computer and use it in GitHub Desktop.
ES6 function vs block scope example
This file contains hidden or 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
for (var i=0; i<5; i++){ | |
setTimeout(() => console.log('function-scoped i:', i), 100); | |
} | |
for (let i=0; i<5; i++){ | |
setTimeout(() => console.log('block-scoped i:', i), 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment