JS Built-ins
← Set83 / 85
SetisDisjointFromintermediate

Set isDisjointFrom() β€” empty set is disjoint from everything

πŸ“– Usage Example
const a = new Set([1, 2])
const b = new Set([3, 4])
a.isDisjointFrom(b)   // β†’ true
a.isDisjointFrom(new Set([2, 5])) // β†’ false

Use Set.isDisjointFrom() to check whether two sets share no elements.

Set.prototype.isDisjointFrom() (ES2025)

The empty Set is disjoint from every Set.

Challenge: Verify that the empty Set is disjoint from any Set.

πŸ’‘ Hints (1)
  • β€’ The empty Set has no elements to share, so it is always disjoint