Computes the list of values that are the intersection of all the arrays — each value in the result is present in each of the arrays (official Underscore docs). Stable Array helper — not deprecated.
Pass the required arguments shown below. Underscore array helpers usually return a new value — check whether the source array is mutated.
Syntax
Call _.intersection. Start with this line.
Underscore
_.intersection(*arrays)
Call
What it does
_.intersection(*arrays)
Primary signature.
_.intersection(...)
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
_.intersection(*arrays)
Parameters
Parameter
Description
*arrays
Required. Lists to compare; first sets result order
Single array. Intersection with itself is a unique copy of that list.
Safe. Never throws on empty inputs.
Compatibility
Browser & Runtime Support
_.intersection 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
_.intersection()
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
_.intersectionUnderscore 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
_.intersection(*arrays) returns values that appear in every array you pass. Official example: _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]) → [1, 2].
As many as you like. It is variadic: _.intersection(a, b, c).
Yes. Each shared value appears only once in the result, even if it repeats in the inputs.
The order of the first array — each value keeps the position of its first appearance there.
With strict equality (===). Primitives match by value; objects and arrays match by reference.
_.union keeps values from any array (combine). _.intersection keeps only values in all arrays (overlap).