forEachRight()
constforEachRight: <T>(collection,iteratee) =>void=eachRight
Alias for eachRight.
Iterates over elements of collection from right to left.
DEPRECATED
Use [...array].reverse().forEach() directly instead.
Type Parameters
T: T
The type of elements in the collection.
Parameters
collection: readonly T[]
The collection to iterate over.
iteratee: (value, index, collection) => void
The function invoked per iteration.
Returns: void
Since
See Also
Array.forEach() - MDN 2.0.0
Example
// ❌ Deprecated approach
eachRight([1, 2, 3], x => console.log(x));
// logs: 3, 2, 1
// ✅ Recommended approach
[...[1, 2, 3]].reverse().forEach(x => console.log(x));
// logs: 3, 2, 1
Deprecated
Use [...array].reverse().forEach() directly instead.
Since
2.0.0