Created
May 28, 2014 21:40
-
-
Save guerrerocarlos/31da4fcff14b01e071f3 to your computer and use it in GitHub Desktop.
functional-javascript-workshop recursion exercise solution
This file contains hidden or 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 reduce(arr, func, initv){ | |
if (!arr.length) return initv | |
else return reduce(arr.slice(1), func, func(initv, arr[0])) | |
} | |
module.exports = reduce |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment