forEachRight eachRight source npm

_.forEachRight(collection, [iteratee=_.identity])

This method is like _.forEach except that it iterates over elements of collection from right to left.

Arguments

  1. collection (Array|Object)

    The collection to iterate over.

  2. [iteratee=_.identity] (Function)

    The function invoked per iteration.

Returns (Array|Object)

Returns collection.

Example

_.forEachRight([1, 2], function(value) {
  console.log(value);
});
// => logs `2` then `1`