Answers for "executes an array of function with reduce js"

90

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
0

js .reducer method

const arrayOfNumbers = [1, 2, 3, 4];
 
const sum = arrayOfNumbers.reduce((accumulator, currentValue) => {  
  return accumulator + currentValue;
});
 
console.log(sum); // 10
Posted by: Guest on February-20-2022

Code answers related to "executes an array of function with reduce js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language