aaray.reduce code example
Example 1: js reduce
let newArray = array.reduce( (acc, element, index, originalArray) => {
// return acc += element
}, initialValue)
Example 2: .reduce mdn
arr.reduce(callback( accumulator, currentValue[, index[, array]] )[, initialValue])