Layout: Title: “Reduce” Date: 2018-01-12 15:31 Categories:

JavaScript Array reduce() Method

The reduce method reduces an array to a single method, The reduce() method executes a provided function for each value of the array (from left-to-right). The return value of the function is stored in an accumulator (result/total).reduce() does not execute the function for array elements without values.

Syntax

arr.reduce(callback[, initialValue]);

Parameters