// Reduce takes in two arguments, a function and an optional starting point.
// example 1
[1, 2, 3].reduce((prev, curr, index) => {
console.log(prev, curr, index);
return prev + curr;
});
// An example of a function that takes in any list of numbers as arguments
// and returns the total sum through a reduce function
function addNumbers() {
return Array.from(arguments).reduce((a, b) => a + b);
}
const total = addNumbers(55, 399, 392, 18, 44, 98, 76, 29);
console.log(total);