Primitives. Underscore returns [] instead of throwing.
Safe default. Easy to call without extra type guards.
Compatibility
Browser & Runtime Support
_.allKeys 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
_.allKeys()
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
_.allKeysUnderscore 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
_.allKeys(object) returns an array of the object’s enumerable property names, including ones inherited through the prototype chain. Official plain-object sample: _.allKeys({one:1, two:2, three:3}) → ["one","two","three"].
_.keys lists only own enumerable properties. _.allKeys also includes enumerable inherited properties from the prototype chain.
No. Only enumerable names are listed — same rule as _.keys — but allKeys also walks prototypes.
_.allKeys returns [] for null, undefined, and primitives instead of throwing.
When inspecting constructor instances and you care about inherited defaults or methods. For plain data objects, _.keys is usually enough.
Order follows the engine’s enumeration (often own keys before inherited). Do not rely on a specific order for correctness.