javascript reduce on object code example
Example 1: .reduce mdn
arr.reduce(callback( accumulator, currentValue[, index[, array]] )[, initialValue])
Example 2: array reduce
arr.reduce(callback( accumulator, currentValue[, index[, array]] ) {
// return result from executing something for accumulator or currentValue
}[, initialValue]);