JavaScript Array reduce function takes a reducer function and an initial value. Using this function one can aggregate, transform items into a new list etc.
Example
//reduce-example.js
const list = [1,2,3,5,8,13];
const reducer = (accumulator, currentValue) => accumulator + currentValue;
console.log(list.reduce(reducer, 0));
Result
32
Read more
Array.prototype.reduce()
on Mozilla Developer Network.
See also
Array.prototype.reduceRight()
on Mozilla Developer Network.