[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Set/intersection [Back]  [Original]

Set.prototype.intersection() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Set.prototype.intersection()

Baseline 2024
Newly available

Since 2024 6, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Set intersection() .

In this article

js
intersection(other)

other

Set

other Set .

(intersection) .

AB={xAxB}A\cap B = {x\in A\mid x\in B}

.

     . A B     . [ . A B .]

intersection() other . this Set this . this other .

  • this other.size other keys() other this .
  • , this other.has(e) this e .

intersection() this other . this other .

intersection()

(<10) (<10) . .

js
const odds = new Set([1, 3, 5, 7, 9]);
const squares = new Set([1, 4, 9]);
console.log(odds.intersection(squares)); // Set(2) { 1, 9 }

Specification
ECMAScript 2027 LanguageSpecification
# sec-set.prototype.intersection


Web Proxy Viewer  |  New URL  |  Original Page