Last active
September 26, 2018 16:32
-
-
Save AhnMo/139a17ea83d3039096261899c701d1c8 to your computer and use it in GitHub Desktop.
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
// inner closures | |
function create(i) { | |
return function () { | |
console.log(i); | |
}; | |
} | |
for (var i = 0; i < 1; i++) { | |
setTimeout(create(i), 100); | |
} |
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
// Please refer: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/let | |
for (let i = 0; i < 1; i++) { | |
setTimeout(() => console.log(i), 100) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment