![]() |
VOOZH | about |
Lodash _.forEachRight() method iterates over elements of collection from right to left. It is almost the same as the _.forEach() method.
_.forEachRight( collection, iteratee );This method returns the collection.
Example 1: In this example, we are iterating the given array from right to left and printing the value in the console.
Output:
python
java
cpp
c
Example 2: In this example, we are iterating the given object from right to left and printing the value in the console.
Output:
y
x
Note: This will not work in normal JavaScript as it requires the lodash library to be installed.