JS Built-ins
← Set81 / 85
SetisDisjointFromintermediate

Set isDisjointFrom() β€” disjoint is true

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

setA.isDisjointFrom(setB) returns true if A and B share no common elements.

Challenge: Verify that disjoint Sets return true.

πŸ’‘ Hints (1)
  • β€’ isDisjointFrom returns true when the Sets share no elements