Answers for "reduce array in javascript"

56

javascript reduce

var array = [36, 25, 6, 15];

array.reduce(function(accumulator, currentValue) {
  return accumulator + currentValue;
}, 0); // 36 + 25 + 6 + 15 = 82
Posted by: Guest on May-21-2020
1

JavaScript Array Methods .reduce()

const list = [1, 2, 3, 4, 5];
console.log(list.reduce((number, nextNumber) => number + nextNumber));
// --> 15
Posted by: Guest on May-07-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language