return object as value in reduce js 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]);