Zero. Drop nothing → full shallow copy of the values.
Oversized. Asking to drop more than length → [], no throw.
Compatibility
Browser & Runtime Support
_.initial ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.x
_.initial()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.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
_.initialUnderscore 1.x+
Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.initial(array, [n]) returns a new array with everything except the last element. Pass n to exclude the last n elements instead.
When n is omitted, Underscore drops one trailing element — the same as _.initial(array, 1).
An empty array []. Dropping more items than exist also returns [], and never throws.
_.initial drops from the end and keeps the front. _.rest drops from the start and keeps the tail.
_.first takes leading items. _.initial keeps leading items by removing trailing ones. Together they cover opposite ends of the array.
No. It returns a new array; the source is unchanged.