array.reduc reduce get previous element of array javascript code example
Example: array reduce
arr.reduce(callback( accumulator, currentValue[, index[, array]] ) {
// return result from executing something for accumulator or currentValue
}[, initialValue]);