Lodash _.isUndefined() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is undefined. Part of Lodash Lang (stable since 0.1.0 — not deprecated). Note: same as value === undefined — null returns false. Use _.isNil when both should match.

Pass the value you want to inspect or convert. Read the return type carefully before you use the result.

Syntax

Call _.isUndefined. Start with this line.

Lodash
_.isUndefined(value)
CallWhat it does
_.isUndefined(value)Primary signature.

Prefer import isUndefined from "lodash/isUndefined" when you want a smaller bundle.

Library declarations
Lodash
_.isUndefined(value)

Parameters

ParameterDescription
valueRequired. Value to check

Return Value

Return ValueDescription
*true if value is undefined, else false

Lodash Examples

Example 1 — Official: void 0 vs null

Only the undefined primitive returns true.

Lodash
console.log(_.isUndefined(void 0)); // true
console.log(_.isUndefined(null));   // false
Try It Yourself

How It Works

  1. void 0. Expression for undefined → true.
  2. null. Different primitive → false.
  3. Strict. No loose grouping with null.
  4. Tip. Need both? Switch to _.isNil.

Example 2 — isUndefined vs isNil

See how the two helpers disagree on null.

Lodash
console.log(_.isUndefined(undefined)); // true
console.log(_.isNil(undefined));       // true

console.log(_.isUndefined(null));      // false
console.log(_.isNil(null));            // true
Try It Yourself

How It Works

  1. Both on undefined. isUndefined and isNil agree → true.
  2. null. isUndefined rejects; isNil accepts.
  3. Pick. Unset-only → isUndefined; any missing → isNil.
  4. Loose trap. value == null behaves like isNil, not isUndefined.

Example 3 — Falsy Values Are Not undefined

Keep 0, empty string, and false as present values.

Lodash
console.log(_.isUndefined(0));     // false
console.log(_.isUndefined(""));    // false
console.log(_.isUndefined(false)); // false
console.log(_.isUndefined(NaN));   // false
Try It Yourself

How It Works

  1. Zero / empty / false. Falsy, but defined values.
  2. NaN. Still a number value → false.
  3. Strict identity. Only === undefined succeeds.
  4. Tip. Do not use !value when you mean “is undefined.”

Example 4 — Missing Props and Optional Args

Absent object keys and omitted parameters are undefined.

Lodash
var user = { name: "Ada" };

console.log(_.isUndefined(user.age)); // true

function greet(name) {
  return _.isUndefined(name) ? "Guest" : name;
}

console.log(greet());       // Guest
console.log(greet("Ada"));  // Ada
Try It Yourself

How It Works

  1. Missing key. user.age was never set → undefined.
  2. Omitted arg. Calling greet() leaves name undefined.
  3. Provided arg. A string is defined → returned as-is.
  4. Note. Reading an undeclared identifier throws ReferenceError before Lodash runs.

Example 5 — Treat Unset Differently From null

Model APIs that leave a field unset vs clear it with null.

Lodash
function statusOf(nickname) {
  if (_.isUndefined(nickname)) {
    return "not set";
  }
  if (_.isNull(nickname)) {
    return "cleared";
  }
  return "set: " + nickname;
}

console.log(statusOf(undefined)); // not set
console.log(statusOf(null));      // cleared
console.log(statusOf("Ada"));     // set: Ada
Try It Yourself

How It Works

  1. undefined. Never provided → "not set".
  2. null. Explicit clear → "cleared".
  3. String. Present value → labeled as set.
  4. Why isUndefined. Collapsing both with isNil would lose that distinction.

Browser & Runtime Support

_.isUndefined has shipped since 0.1.0 and is available in Lodash 4.x (and earlier 3.x builds). 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 === undefined, but not this helper by name.

✓ Stable · Lodash 4.x

_.isUndefined()

Available in [email protected] full builds and the lodash/isUndefined modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.isUndefined Lodash 4.x

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import isUndefined from "lodash/isUndefined" for smaller builds. Equivalent to value === undefined as a named function.

Frequently Asked Questions

_.isUndefined(value) returns true only when value is the undefined primitive. null, 0, "", false, and NaN all return false.
No. Only exact undefined matches. null is a separate sentinel — use _.isNull or _.isNil for that.
Use _.isUndefined when only the missing/unset case matters. Use _.isNil when either null or undefined should take the same branch.
Yes. Lodash implements it as value === undefined — a named helper for readability next to other lang guards.
Yes. void 0 evaluates to undefined, matching the official Lodash example.
Use import isUndefined from "lodash/isUndefined" or require("lodash/isUndefined") so bundlers can tree-shake unused Lodash code. Full build: import _ from "lodash" then _.isUndefined.

Next: _.isWeakMap()

Check whether a value is classified as a WeakMap.

_.isWeakMap() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful