js-util

Home > rc-js-util > ATypedArrayTuple > reduceRight

ATypedArrayTuple.reduceRight() method

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Signature:

reduceRight(_callbackfn: (previousValue: number, currentValue: number, currentIndex: TExtractIndexes<this>, array: this) => number, initialValue?: number): number;

Parameters

Parameter Type Description
_callbackfn (previousValue: number, currentValue: number, currentIndex: TExtractIndexes<this>, array: this) => number A function that accepts up to four arguments. The reduceRight method calls the _callbackfn function one time for each element in the array.
initialValue number (Optional) If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the _callbackfn function provides this value as an argument instead of an array value.

Returns:

number