JS Built-ins
← Set80 / 85
SetisSupersetOfintermediate

Set isSupersetOf() β€” single element check

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

Use Set.isSupersetOf() to check whether a set contains all elements of another set.

Set.prototype.isSupersetOf() (ES2025)

A Set is a superset of {x} if and only if it contains x.

Challenge: Verify single-element superset behavior.

πŸ’‘ Hints (1)
  • β€’ isSupersetOf({x}) is equivalent to has(x)