Method Array.reduce()
- Method reduce
mixed
reduce(function
(:void
)fun
,array
arr
,mixed
|void
zero
)- Description
reduce() sends the first two elements in
arr
tofun
, then the result and the next element inarr
tofun
and so on. Then it returns the result. The function will returnzero
ifarr
is the empty array. Ifarr
has only one element, that element will be returned.- See also