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

Set.prototype.isDisjointFrom() - 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.isDisjointFrom()

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 isDisjointFrom() .

In this article

js
isDisjointFrom(other)

other

Set

other true, false .

. .

A is disjoint from BAB=A\text{ is disjoint from }B \Leftrightarrow A\cap B = \empty

.

     .       A B  . [ . A B .]

union() other . this this Set . this other .

  • this other.size other keys() other , other this false ( return() keys() ). true .
  • , this this e other.has(e) false . true .

isDisjointFrom() this other ( ).

isDisjointFrom()

(20 ) (20 ) , 1 .

js
const primes = new Set([2, 3, 5, 7, 11, 13, 17, 19]);
const squares = new Set([1, 4, 9, 16]);
console.log(primes.isDisjointFrom(squares)); // true

1 (20 ) (20 ) .

js
const composites = new Set([4, 6, 8, 9, 10, 12, 14, 15, 16, 18]);
const squares = new Set([1, 4, 9, 16]);
console.log(composites.isDisjointFrom(squares)); // false

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


Web Proxy Viewer  |  New URL  |  Original Page