JS Built-ins
← Set76 / 85
SetisSupersetOfintermediate

Set isSupersetOf() β€” superset is true

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

setA.isSupersetOf(setB) returns true if all elements of B are in A.

Challenge: Verify that a superset returns true.

πŸ’‘ Hints (1)
  • β€’ isSupersetOf returns true if every element of B exists in A