Standard built-ins
Array.prototype.reduceRight()
Reads present indices from high to low. Each callback receives accumulator, value, index, source and returns the next accumulator. If initialValue is absent, the first encountered present value initializes it; no present value then causes TypeError.
Formal Syntax & Structure
javascript syntaxjavascript
array.reduceRight(callback, initialValue?)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| callback | function | Produces the next accumulator. |
| initialValue | any | Explicit starting accumulator; omitted uses first encountered present value. |
Return Value
any
Final accumulator.
Working Example
Example Snippetjavascript
console.log([4,3,2].reduceRight((a,b)=>a+b,""));