JS Built-ins
← Set79 / 85
SetisSupersetOfintermediate

Set isSupersetOf() β€” equal sets are supersets

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

Equal Sets are supersets of each other.

Challenge: Verify that equal Sets are supersets of each other.

πŸ’‘ Hints (1)
  • β€’ A set is always a superset of itself or any equal set