Skip to content

Instantly share code, notes, and snippets.

@alexandr-kazakov
Created September 13, 2018 16:54
Show Gist options
  • Save alexandr-kazakov/3da1016840629de8704a62b9b34ba83b to your computer and use it in GitHub Desktop.
Save alexandr-kazakov/3da1016840629de8704a62b9b34ba83b to your computer and use it in GitHub Desktop.
'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