method ReadonlyArray.reduceRight
Private
ReadonlyArray.reduceRight(callbackfn: (
previousValue: T,
currentValue: T,
currentIndex: number,
array: readonly T[],
) => T
): T

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.

Parameters

callbackfn: (
previousValue: T,
currentValue: T,
currentIndex: number,
array: readonly T[],
) => T

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

Return Type

T
ReadonlyArray.reduceRight(
callbackfn: (
previousValue: T,
currentValue: T,
currentIndex: number,
array: readonly T[],
) => T
,
initialValue: T,
): T

Parameters

callbackfn: (
previousValue: T,
currentValue: T,
currentIndex: number,
array: readonly T[],
) => T
initialValue: T

Return Type

T
ReadonlyArray.reduceRight<U>(
callbackfn: (
previousValue: U,
currentValue: T,
currentIndex: number,
array: readonly T[],
) => U
,
initialValue: U,
): U

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.

Type Parameters

Parameters

callbackfn: (
previousValue: U,
currentValue: T,
currentIndex: number,
array: readonly T[],
) => U

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

initialValue: U

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.

Return Type