Like _.forEach, but iterates right to left. On arrays it starts at the last index. Return false to stop early. Alias: _.eachRight. Part of Lodash 4.x Collection (since 2.0.0).
Pass the required arguments shown below. Lodash Collection helpers usually return a new value — check whether the source is mutated.
Syntax
Call _.forEachRight on a collection. Start with this line.
Lodash
_.forEachRight(collection, [iteratee=_.identity])
Call
What it does
_.forEachRight(collection, [iteratee=_.identity])
Primary signature.
_.forEachRight(collection)
Call with a collection argument.
Prefer import forEachRight from "lodash/forEachRight" when you want a smaller bundle.
Library declarations
Lodash
_.forEachRight(collection, [iteratee=_.identity])
Parameters
Parameter
Description
collection
Required. Array or object to iterate
iteratee
Optional. Called per element; default _.identity
Return Value
Return Value
Description
*
The original collection
Lodash Examples
Example 1 — Official: Log Right to Left
Visit [1, 2] starting at the last element.
Lodash
var logged = [];
_.forEachRight([1, 2], function (value) {
logged.push(value);
});
// logged → [2, 1]
Same rule. Only boolean false breaks (like _.forEach).
Example 5 — _.forEach vs _.forEachRight
Same array, opposite visit order.
Lodash
var left = [];
var right = [];
_.forEach([1, 2, 3], function (n) { left.push(n); });
_.forEachRight([1, 2, 3], function (n) { right.push(n); });
// left → [1, 2, 3]
// right → [3, 2, 1]
No copy. Neither method reverses the source array.
Pick. Use Right for “newest / last first” effects.
Compatibility
Browser & Runtime Support
_.forEachRight is a Lodash 4.x Collection helper (alias _.eachRight, since 2.0.0). It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native Array.forEach has no built-in right-to-left mode.
✓ Stable · Lodash 4.x
_.forEachRight()
Available in [email protected] full builds and the lodash/forEachRight modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.forEachRightLodash 4.x+
Bottom line: Safe for production once Lodash is loaded. Prefer import forEachRight from "lodash/forEachRight" for smaller builds. Use when reverse visit order (or early exit from the end) matters.
Frequently Asked Questions
_.forEachRight(collection, iteratee) calls iteratee for each element from right to left. On arrays it starts at the last index. It returns the original collection.
Same API and early-exit rules — only the visit order changes. forEach goes left-to-right; forEachRight goes right-to-left.
Return boolean false from the iteratee. Lodash stops visiting further elements (toward the start).
_.eachRight is an alias of _.forEachRight — same behavior.
forEachRight avoids allocating a reversed copy and keeps Lodash iteratee behavior consistent.
Object key order follows Lodash enumeration. Prefer arrays when reverse order must be predictable.