Constant. Builds a function that yields 7 when called.
Noop. Ignores 7 and returns undefined.
Pick by intent. Pass-through → identity. Fixed value → constant. Do nothing → noop.
Compatibility
Browser & Runtime Support
_.noop ships with Underscore.js (1.7.0+). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.7+
_.noop()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.7+
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
_.noopUnderscore 1.7+
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
_.noop is an empty function. It ignores every argument and always returns undefined. Underscore’s docs say it is useful as the default for optional callback arguments.
obj.initialize = _.noop assigns the empty function as a placeholder method. Calling obj.initialize() returns undefined and does no work.
Usually _.noop — the function reference. Parentheses call it immediately and give you undefined, not something you can call later. Write callback = callback || _.noop, not callback = _.noop().
identity returns the argument. constant(value) returns a function that always yields that value. noop ignores arguments and always returns undefined.
Use it when an API requires a function but you have nothing to do: optional callbacks, stub methods like initialize, or an iteratee that should produce undefined.
No. It is a stable Underscore utility added in version 1.7.0 as a handy empty placeholder function.