Created
August 30, 2011 11:03
-
-
Save vstarck/1180661 to your computer and use it in GitHub Desktop.
gejs5.3.js
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
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