JS Built-ins
← Set85 / 85
SetisDisjointFromintermediate

Set isDisjointFrom() β€” identical sets are not disjoint

πŸ“– 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)

Identical non-empty Sets are not disjoint β€” they share all elements.

Challenge: Verify that identical Sets are not disjoint.

πŸ’‘ Hints (1)
  • β€’ Non-empty identical Sets share all their elements, so they are not disjoint