jPaq Docs - Array.prototype.reduceRight()

Quick Stats

Target Platforms:  PC (JScript) and the web (JavaScript)
Download Count:  743

Summary

Accumulate the values of an array (from right-to-left) in order to reduce it to a single value.

Parameters

  1. fnCallback => Function
    The accumulator function. The first parameter is the value that has been accumulated so far. If the "initial" value is, the first parameter will be "initial" the first time this is called. Otherwise, the first value will be the value of the last element in the array. The second parameter will be the value that needs to be accumulated (or added) to the first parameter. The third will be the index of this parameter within the array. The fourth will be a reference to this array. This function should return the result of accumulating the current value (parameter two) to the previous value (parameter one).
  2. [initial] => Object
    Optional. The value of the first parameter passed to the first call to the accumulator function.

Returns

Object
The result of accumulating all of the values within the array.