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