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

Set.prototype.isDisjointFrom() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Set.prototype.isDisjointFrom()

2024

20246

Set isDisjointFrom()

js
isDisjointFrom(other)

other

Set

other true false

A  B  AB=A\text{ }B \text{ } \Leftrightarrow A\cap B = \empty

 A  B [ A B ]

isDisjointFrom() other this Set this this other

  • this other.size other keys() other other this false keys() return() true
  • 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

20 20 1

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

ECMAScript 2027 LanguageSpecification
# sec-set.prototype.isdisjointfrom


Web Proxy Viewer  |  New URL  |  Original Page