Created
September 13, 2018 16:54
-
-
Save alexandr-kazakov/3da1016840629de8704a62b9b34ba83b to your computer and use it in GitHub Desktop.
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
'use strict'; | |
var result = []; | |
for (var i = 0; i < 5; i++) { | |
result[i] = (function(i) { | |
return function() { | |
console.log(i); | |
}; | |
})(i); | |
} | |
result[0](); | |
result[1](); | |
result[2](); | |
result[3](); | |
result[4](); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment