carsca
8/17/2019 - 7:40 AM

JavaScript Array reduce syntax

const myArray = [ 1, 2, 3 ];

\!h const total = myArray.reduce((runningTotal, number, index) => runningTotal + number, 0);

console.log(total);