Method Array.reduce()
- Method
reduce
mixedreduce(function(:void)fun,arrayarr,mixed|voidzero)- Description
reduce() sends the first two elements in
arrtofun, then the result and the next element inarrtofunand so on. Then it returns the result. The function will returnzeroifarris the empty array. Ifarrhas only one element, that element will be returned.- See also