Lodash _.noop() Method

Beginner
5 min read
Updated: Nov 2026
4 examples
Util

Definition

A function that does nothing and returns undefined. Handy as a default callback or empty iteratee. Part of Lodash Util since 2.3.0 (stable — not deprecated).

Pass the arguments shown below. Prefer modular imports when you only need this helper.

Syntax

Call _.noop. Start with this line.

Lodash
_.noop()
CallWhat it does
_.noop()Primary signature.
_.noop(...)Call the util helper.

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

Library declarations
Lodash
_.noop()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*Always undefined

Lodash Examples

Example 1 — Official: _.times(2, _.noop)

Pass _.noop as the iteratee — each call returns undefined.

Lodash
_.times(2, _.noop);
// → [undefined, undefined]
Try It Yourself

How It Works

  1. Iterate. _.times(2, …) calls the iteratee twice.
  2. Pass function. _.noop is the iteratee (no parentheses).
  3. Each call. Returns undefined.
  4. Result. Array of two undefined values.

Example 2 — Default Optional Callback

Use _.noop so callers never need a null check.

Lodash
function runTask(onDone) {
  onDone = onDone || _.noop;
  // … do work …
  onDone();
  return 'done';
}

runTask();
// → 'done'  (onDone was _.noop — safe no-op)
Try It Yourself

How It Works

  1. Default. Missing onDone becomes _.noop.
  2. Call safely. onDone() never throws.
  3. Return. Task still returns 'done'.
  4. Why. Avoids if (onDone) onDone() boilerplate.

Example 3 — noop vs identity

Same input, different returns.

Lodash
_.noop(42);
// → undefined

_.identity(42);
// → 42
Try It Yourself

How It Works

  1. noop. Ignores 42 → undefined.
  2. identity. Returns the first argument → 42.
  3. Choose. Discard → noop; pass through → identity.
  4. Constant. Need a fixed return? Use _.constant.

Example 4 — _.noop vs _.noop()

Parentheses call the function immediately.

Lodash
typeof _.noop;
// → 'function'

typeof _.noop();
// → 'undefined'

// callbacks need the function:
_.times(1, _.noop);   // ✓
// _.times(1, _.noop()); // ✗ iteratee is undefined
Try It Yourself

How It Works

  1. Reference. _.noop is the function object.
  2. Call. _.noop() runs it → undefined.
  3. APIs. Pass the reference so Lodash can call it later.
  4. Rule. Default callback → _.noop, never _.noop().

Browser & Runtime Support

_.noop is a Lodash Util helper since 2.3.0. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 2.3.0+

_.noop()

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

100% With Lodash 2.3+
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
_.noop Lodash 2.3.0+

Bottom line: Safe for production once Lodash is loaded. Prefer import noop from "lodash/noop" for smaller bundles. Pass _.noop (not _.noop()) as callbacks.

Frequently Asked Questions

_.noop is a function that does nothing and returns undefined. Pass the function reference _.noop (no parentheses) wherever an API needs a callback you do not care about.
Usually _.noop — that passes the function. _.noop() calls it immediately and yields undefined. Using _.noop() as a callback argument is almost always wrong.
As a default optional callback, a harmless iteratee for _.times / _.forEach, or a stub when a function is required but you have no work to do.
_.identity returns its first argument. _.noop ignores arguments and always returns undefined. Pass values through with identity; discard work with noop.
Yes, an empty arrow function behaves similarly. _.noop is a single shared reference, which helps equality checks and avoids allocating a new function each time.
No. It is a stable Lodash Util method since 2.3.0.

Next: _.nthArg()

Create a function that returns the argument at index n.

_.nthArg() tutorial →

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