Last active
October 9, 2015 00:53
-
-
Save nickbalestra/f94181fbe769b128d1d3 to your computer and use it in GitHub Desktop.
Recursive Reduce and Each
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
function recursiveEach(list, iterator) { | |
if (list.length === 0) { | |
return undefined; | |
} | |
iterator(list[0]); | |
return recursiveEach(list.slice(1), iterator); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment