JS Built-ins
← Set82 / 85
SetisDisjointFromintermediate

Set isDisjointFrom() β€” non-disjoint is false

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

If A and B share any element, isDisjointFrom returns false.

Challenge: Verify that non-disjoint Sets return false.

πŸ’‘ Hints (1)
  • β€’ isDisjointFrom returns false if any element is shared between A and B