Last._.last keeps only the dropped tail value → 3.
Pair.initial + last split a list into “prefix” and “final item”.
Compatibility
Browser & Runtime Support
_.initial is a Lodash 4.x Array helper (available since early Lodash). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 4.x
_.initial()
Available in [email protected] full builds and the lodash/initial 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
_.initialLodash 4.x+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import initial from "lodash/initial" for smaller builds. Native alternative: arr.slice(0, -1).
Frequently Asked Questions
_.initial(array) returns a new array with every element except the last. The original array is not changed.
Both return []. An empty array has nothing to keep; a one-element array’s only item is the last, so dropping it leaves nothing.
No. It returns a new slice. The source array is unchanged.
_.tail drops the first element. _.initial drops the last element. They are opposites.
For ordinary arrays the result matches arr.slice(0, -1) and _.dropRight(arr, 1). Lodash keeps the same import style as other helpers.
Use import initial from "lodash/initial" or require("lodash/initial") for tree-shaking friendly bundles. Full build: import _ from "lodash" then _.initial.