Safe. No throw — fine in pipelines that may receive empty lists.
Guard. Check length before assuming leftover items exist.
Compatibility
Browser & Runtime Support
_.dropRight is a Lodash 4.x Array helper. It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 4.x
_.dropRight()
Available in [email protected] full builds and the lodash/dropRight 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
_.dropRightLodash 4.x+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import dropRight from "lodash/dropRight" for smaller builds. Not a native browser API — load Lodash first.
Frequently Asked Questions
_.dropRight(array, n) creates a new array with the last n elements removed from the end. The default for n is 1. The source array is not mutated.
No. Lodash returns a new array (a slice of the remaining elements). The input stays unchanged.
When n is omitted, Lodash drops one element from the end — the same “all but last” case as _.initial on a normal array.
You get an empty array []. Nothing throws.
Nothing is dropped. You get a new array with every element (shallow copy, like slice of the whole array).
Use import dropRight from "lodash/dropRight" or require("lodash/dropRight") so bundlers can tree-shake. Full build: import _ from "lodash" then _.dropRight.