Checks if value is null or undefined (nullish). Part of Lodash Lang since 4.0.0 (stable — not deprecated). Note: same idea as value == null — 0, "", false, and NaN are not nil.
Pass the value you want to inspect or convert. Read the return type carefully before you use the result.
Syntax
Call _.isNil. Start with this line.
Lodash
_.isNil(value)
Call
What it does
_.isNil(value)
Primary signature.
Prefer import isNil from "lodash/isNil" when you want a smaller bundle.
Why. Safer than value || fallback, which would replace 0.
Compatibility
Browser & Runtime Support
_.isNil is a Lodash 4.x Lang helper (since 4.0.0). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native engines express the same idea with value == null or nullish coalescing (??), but not this helper by name.
✓ Stable · Lodash 4.0.0+
_.isNil()
Available in [email protected] full builds and the lodash/isNil 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
_.isNilLodash 4.0.0+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import isNil from "lodash/isNil" for smaller builds. Equivalent to value == null as a named function.
Frequently Asked Questions
_.isNil(value) returns true when value is null or undefined — the two nullish values. Everything else, including 0, "", false, and NaN, returns false.
No. Falsy values like 0, "", and false are not nil. Only null and undefined count.
No. NaN is a defined numeric value. _.isNil(NaN) is false — matching the official Lodash docs.
isNull checks only null. isUndefined checks only undefined. isNil matches either one (like value == null).
Yes — same semantics. Lodash gives you a named helper for readability and chaining with other lang guards.
Use import isNil from "lodash/isNil" or require("lodash/isNil") so bundlers can tree-shake unused Lodash code. Full build: import _ from "lodash" then _.isNil.