Skip to content

Instantly share code, notes, and snippets.

@cho45
Forked from mhayashi/gist:662190
Created November 4, 2010 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cho45/662194 to your computer and use it in GitHub Desktop.
Save cho45/662194 to your computer and use it in GitHub Desktop.
var sub = function (i) {
var a = arguments;
return function(cb) {
cb && cb.apply(null, a);
};
};
var array = [1, 2, 3];
for (var i = 0, len = array.length; i < len; i++)
sub(array[i], i)(function(item, index) { console.log(item, index);});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment