reduceRight()
reduceRight<
T
,R
>(fn
): (initVal
) => (arr
) =>R
Calls the accumulator with each element of the given array, starting with the last element. Returns the final result.
Type Parameters
• T
• R
Parameters
fn
Accumulator
<T
, R
>
The accumulator function to apply to each element of the array.
Returns
Function
Parameters
initVal
R
Returns
Function
Parameters
arr
T
[]
Returns
R
Remarks
pure function
Example
import { reduceRight } from '@accelint/core';
reduceRight((base, s) => `${base}${s}`)('')(['a', 'b', 'c', 'd', 'e']);
// 'edcba'