Gives control of the global _ variable back to its previous owner (official Underscore docs). Returns a reference to the Underscore object so you can keep using it under another name.
Pass the required arguments shown below. Underscore utility helpers usually return a new value or function — check edge cases before you ship.
Syntax
Call _.noConflict. Start with this line.
Underscore
_.noConflict()
Call
What it does
_.noConflict()
Primary signature.
_.noConflict(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Library declarations
Underscore
_.noConflict()
Parameters
This method has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
The Underscore object
Underscore.js Examples
Example 1 — Official Rename
Capture the return value so Underscore stays reachable under a new name.
Underscore
var underscore = _.noConflict();
underscore.first([10, 20, 30]);
// → 10
Simulate another library owning _ before Underscore loads, then free the name.
Underscore
// Imagine this ran before Underscore's script:
// window._ = { brand: "other-lib" };
var us = _.noConflict();
// us is Underscore
us.VERSION; // e.g. "1.13.8"
// global _ is the previous owner again
// (in a clean page with no prior _, typeof _ === "undefined")
Use us. All later API calls go through that variable.
Skip a second call. Global _ no longer has noConflict.
Rule. Assign once at startup; never rely on global _ afterward.
Compatibility
Browser & Runtime Support
_.noConflict ships with the UMD / browser script build of Underscore.js. It is omitted from ES module, AMD, and CommonJS builds because those never claim a shared global _.
✓ Stable · UMD / script tag
_.noConflict()
Available when Underscore is loaded as a global (e.g. [email protected] UMD CDN). Not exported in ESM/CJS module entry points.
UMDScript-tag / UMD builds
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
_.noConflictUMD only
Bottom line: Use noConflict only with a script-tag or UMD build. With npm ESM/CJS imports, bind Underscore to a local name instead — there is no global conflict to resolve.
Frequently Asked Questions
_.noConflict() restores the global _ variable to whatever it was before Underscore loaded, then returns the Underscore object. Capture that return value — var underscore = _.noConflict() — so you can keep calling Underscore methods.
var underscore = _.noConflict(); After that line, call underscore.map or underscore.first instead of _.map. Global _ belongs to its previous owner again.
No. It only changes the global _. Underscore still exists on the variable you assigned from the return value.
No. Assign the return value once. After the first call, global _ is no longer Underscore, so a second _.noConflict() typically throws.
The official docs say the helper is not present if you import Underscore with ES6, AMD, or CommonJS. Those loaders never take over a shared global _, so there is nothing to restore. Use the UMD/script-tag build when you need noConflict.
No. It is a stable Underscore utility for browser script-tag setups where another library also wants the _ name.