Skip to content

Instantly share code, notes, and snippets.

@vstarck
Created August 30, 2011 11:03
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 vstarck/1180661 to your computer and use it in GitHub Desktop.
Save vstarck/1180661 to your computer and use it in GitHub Desktop.
gejs5.3.js
arr = [1,2,3,5,6,7,8,9,10]
arr.reduce(function(memo, current, index) {
return function() {
console.log(current);
memo();
}
}, function() {})();
// reduce executes the callback function once for each
// element present in the array, excluding holes in
// the array
// Con lo cual el siguiente caso no funciona :<
(new Array(100)).reduce(function(memo, current, index) {
return function() {
console.log(current);
memo();
}
}, function() {})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment