Skip to content

Instantly share code, notes, and snippets.

@peterschussheim
Last active September 21, 2016 22:13
Show Gist options
  • Save peterschussheim/808a31189ead73040c450c10ed4cfa7c to your computer and use it in GitHub Desktop.
Save peterschussheim/808a31189ead73040c450c10ed4cfa7c to your computer and use it in GitHub Desktop.
createFunctions
function createFunctions(n) {
var callbacks = [];
var factory = function(x) {
return function() {
return x;
};
};
callbacks.forEach(function(cb) {
callbacks.push(factory(i));
});
return callbacks;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment