Practical javascript: reduce method

According to the official documentation from Mozilla, the reduce() method executes a reducer function on each of the elements of an array, returning a single value as a result. array.reduce(callback(accumulator, currentValue, [index], [array]), [initValue]) This method must receive as a mandatory parameter the reducer function callback and optionally can receive an initial value. In turn, the reducer function must mandatorily receive an accumulator and the current iteration value, and as optional values, the iteration index and the array on which the reduce() method was called....

19-11-2019 4 min 760 words Antonio José Masiá