Skip to content

Instantly share code, notes, and snippets.

@guerrerocarlos
Created May 28, 2014 21:40
Show Gist options
  • Save guerrerocarlos/31da4fcff14b01e071f3 to your computer and use it in GitHub Desktop.
Save guerrerocarlos/31da4fcff14b01e071f3 to your computer and use it in GitHub Desktop.
functional-javascript-workshop recursion exercise solution
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