Skip to content

Instantly share code, notes, and snippets.

@vldvel
Created February 27, 2018 08:40
Show Gist options
  • Select an option

  • Save vldvel/5de5b80ce914b009bfa6e38b30911678 to your computer and use it in GitHub Desktop.

Select an option

Save vldvel/5de5b80ce914b009bfa6e38b30911678 to your computer and use it in GitHub Desktop.
array.reduce(param1[, param2]);
// param1 - Function(accumulator, currentValue, index, array)
// param2 - accumulator's initial value
// EXAMPLE
[1, 2, 3, 4, 5].reduce((acc, val, i) => {
return acc += val;
}, 0); // 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment