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