UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

70 lines (33 loc) 1.61 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [ATypedArrayTuple](./rc-js-util.atypedarraytuple.md) &gt; [reduceRight](./rc-js-util.atypedarraytuple.reduceright_1.md) ## 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:** ```typescript reduceRight(_callbackfn: (previousValue: number, currentValue: number, currentIndex: TExtractIndexes<this>, array: this) => number, initialValue?: number): number; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> \_callbackfn </td><td> (previousValue: number, currentValue: number, currentIndex: [TExtractIndexes](./rc-js-util.textractindexes.md)<!-- -->&lt;this&gt;, array: this) =&gt; number </td><td> A function that accepts up to four arguments. The reduceRight method calls the \_callbackfn function one time for each element in the array. </td></tr> <tr><td> initialValue </td><td> number </td><td> _(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. </td></tr> </tbody></table> **Returns:** number