Safe. No throw — fine in pipelines with optional data.
Guard. Check length before assuming a suffix exists.
Compatibility
Browser & Runtime Support
_.takeRight is a Lodash 4.x Array helper (since 3.0.0). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 3.0.0+
_.takeRight()
Available in [email protected] full builds and the lodash/takeRight 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
_.takeRightLodash 3.0.0+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import takeRight from "lodash/takeRight" for smaller builds. Not a native browser API — load Lodash first.
Frequently Asked Questions
_.takeRight(array, n) creates a new array with up to n elements 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 trailing elements). The input stays unchanged.
When n is omitted, Lodash takes one element from the end — the same everyday “last item only” case as _.last, but as a one-element array.
You get every element — a shallow copy of the whole array. Nothing throws.
You get an empty array []. Nothing is taken from the end.
Use import takeRight from "lodash/takeRight" or require("lodash/takeRight") so bundlers can tree-shake. Full build: import _ from "lodash" then _.takeRight.