Skip to content

Instantly share code, notes, and snippets.

@BrianHicks
Created March 27, 2013 20:24
Show Gist options
  • Save BrianHicks/5257697 to your computer and use it in GitHub Desktop.
Save BrianHicks/5257697 to your computer and use it in GitHub Desktop.
// reducer
function reduce(arr, func, init) {
for (var i = 0; i < arr.length; i++) {
init = func(init, arr[i], i, arr);
}
return init
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment