JavaScript Set intersection()
Example
const A = new Set(['a','b','c']);
const B = new Set(['b','c','d']);
const C = A.intersection(B);
Try it Yourself »
Description
The intersection()
method returns the intersection of two sets.
The intersection()
method returns a new set containing
the elements which are in this set and in the argument set:
Syntax
intersection(set)
Parameters
Parameter | Description |
set | Required. The set to do the intersection operation with. |
Return Value
Type | Description |
Set | A set object with the intersection of the two sets. |
Set Logic Metods:
See Also:
Browser Support
Set.union()
is supported in all modern browsers since June 2024:
Chrome 122 | Edge 122 | Firefox 127 | Safari 17 | Opera 108 |
Feb 2024 | Feb 2024 | Jun 2024 | Sep 2023 | Mar 2024 |