Returns true if the value is present in the list. Arrays use indexOf internally; optional fromIndex starts the search at a given index (official Underscore docs). Stable Collection helper — not deprecated.
Pass the required arguments shown below. Underscore collection helpers usually return a new value — check whether the source is mutated.
Syntax
Call _.contains. Start with this line.
Underscore
_.contains(list, value, [fromIndex])
Call
What it does
_.contains(list, value, [fromIndex])
Primary signature.
_.contains(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Aliases.include / includes call the same function as contains.
Types.3 and "3" never match under ===.
Same ref. Object a in the array matches itself.
Look-alike. A new { id: 1 } is a different reference → false.
Compatibility
Browser & Runtime Support
_.contains (aliases _.include / _.includes) ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.
✓ Stable · Underscore 1.x
_.contains()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.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
_.containsUnderscore 1.x+
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
_.contains(list, value, [fromIndex]) returns true if value is present in the list. The official example is _.contains([1, 2, 3], 3) → true.
Yes. include and includes are aliases of contains. They call the same function.
With strict equality (===). So 3 and "3" do not match, and two objects match only if they are the same reference.
Optional start index. The search begins at that position; earlier matches are ignored. Arrays use indexOf under the hood.
_.contains checks for an exact value. _.some runs a predicate and returns true if any element passes your test.
Yes. For a plain object it searches the object’s values (not keys), so _.contains({ a: 1, b: 2 }, 2) is true.