set.isSupersetOf(other) checks whether the Set contains every value of other. It returns true if nothing in other is missing from the Set, and false if at least one value is missing.
It is the mirror of isSubsetOf(): big.isSupersetOf(small) is the same question as small.isSubsetOf(big). The method returns only a boolean, and it does not change either Set.
Remember
big.isSupersetOf(small)
big has every value of small → true
a value of small is missing → false
Every Set is a superset of an empty Set
A Set is a superset of itself
Same as: small.isSubsetOf(big)
Syntax
Call it on the bigger Set and pass the Set whose values you want to find. Use the boolean in an if statement.
JavaScript
const known = new Set(["html", "css", "js"]);
const needed = new Set(["html", "css"]);
console.log(known.isSupersetOf(needed)); // true
console.log(needed.isSupersetOf(known)); // false
Call
What it does
a.isSupersetOf(b)
true if a contains every value of b.
b.isSubsetOf(a)
The same question asked from the smaller Set.
[...b].every((x) => a.has(x))
The older way to write the same check.
a.isSupersetOf(map)
A Map works as the argument, and its keys are compared.
// ECMAScript 2025
Set.prototype.isSupersetOf(other)
// other : a Set, or a set-like object (needs size, has() and keys())
// returns: true or false
// throws : TypeError if other is not set-like (for example an array)
Parameters
Parameter
Description
other
Required. A Set, or any set-like object: an object with a numeric size and the methods has() and keys(). A Map is set-like. An array is not, so convert it with new Set(array).
Return Value
Return Value
Description
true
The Set contains every value of other. This includes equal Sets, and the case where other is empty.
false
At least one value of other is not in the Set.
TypeError (thrown)
other is not set-like, for example an array or a number.
JavaScript Examples
Example 1 — Check That a Set Has Everything
A team knows several skills. Check if it covers what a project needs, and what happens in the opposite direction.
JavaScript
const team = new Set(["html", "css", "js", "sql"]);
const project = new Set(["html", "js"]);
const bigProject = new Set(["html", "js", "python"]);
console.log("Team covers project: " + team.isSupersetOf(project));
console.log("Team covers big project: " + team.isSupersetOf(bigProject));
console.log("Project covers team: " + project.isSupersetOf(team));
Team covers project: true
Team covers big project: false
Project covers team: false
The Try It page first checks that Set.prototype.isSupersetOf() exists, because it is new in ES2025. In an older browser it prints a short explanation and the output above. In current browsers and in Node.js 22 or newer, it runs the code for real.
How It Works
Covered.html and js are both in team, so team.isSupersetOf(project) is true.
One is missing.python is not in team, so the big project is not covered and the answer is false.
Wrong direction. The small Set cannot contain everything in the bigger one, so the last line is false.
Example 2 — Equal and Empty Sets
Special cases: an empty Set, an equal copy, and the sizes you can use to ask for a strict superset.
JavaScript
const a = new Set([1, 2, 3]);
const copy = new Set([1, 2, 3]);
console.log("Empty Set: " + a.isSupersetOf(new Set()));
console.log("Equal copy: " + a.isSupersetOf(copy));
console.log("Empty is superset of a: " + new Set().isSupersetOf(a));
const strict = a.isSupersetOf(copy) && a.size > copy.size;
console.log("Strict superset: " + strict);
Empty Set: true
Equal copy: true
Empty is superset of a: false
Strict superset: false
The Try It page first checks that Set.prototype.isSupersetOf() exists, because it is new in ES2025. In an older browser it prints a short explanation and the output above. In current browsers and in Node.js 22 or newer, it runs the code for real.
How It Works
Every Set has an empty one inside. There is no value in the empty Set that could be missing, so the answer is true.
Equal copy.a has every value of copy, so it is a superset of it. An empty Set, on the other hand, is not a superset of a Set that has values.
Strict superset. To require extra values, also compare the sizes. Both are 3, so a.size > copy.size is false.
Example 3 — A Feature Check with a Map
A plan must include all required features. Check it with a Set, then with the keys of a Map.
JavaScript
const required = new Set(["login", "search"]);
const basic = new Set(["login"]);
const pro = new Set(["login", "search", "export"]);
console.log("Basic plan: " + basic.isSupersetOf(required));
console.log("Pro plan: " + pro.isSupersetOf(required));
const prices = new Map([["login", 0], ["search", 5], ["export", 9]]);
console.log("Set covers the keys: " + new Set(prices.keys()).isSupersetOf(required));
Basic plan: false
Pro plan: true
Set covers the keys: true
The Try It page first checks that Set.prototype.isSupersetOf() exists, because it is new in ES2025. In an older browser it prints a short explanation and the output above. In current browsers and in Node.js 22 or newer, it runs the code for real.
How It Works
Basic plan. It has login but not search, so it is not a superset of required.
Pro plan. It has both required features and an extra one, so the answer is true. Extra values do no harm.
From Map keys.prices.keys() gives the feature names, and new Set(...) turns them into a Set that can be checked in the same way.
Compatibility
Browser & Runtime Support
Set.prototype.isSupersetOf() is one of the new Set methods added in ES2025. It works in current browsers and in Node.js 22 or newer, but not in older versions.
✓ Newer · ES2025
set.isSupersetOf()
Supported in Chrome 122+, Edge 122+, Firefox 127+, Safari 17+, Opera 108+ and Node.js 22+. Internet Explorer never got it.
ES2025Standard since
Google Chrome122+ · Desktop & Mobile
Full support
Microsoft Edge122+ · Chromium based
Full support
Mozilla Firefox127+ · Desktop & Mobile
Full support
Apple Safari17+ · macOS & iOS
Full support
Opera108+ · Chromium based
Full support
Samsung Internet26+ · Android
Supported
Android WebView122+ · Chromium based
Supported
Node.js22+ · Server runtime
Supported
DenoRecent versions · JavaScript runtime
Supported
BunRecent versions · JavaScript runtime
Supported
Internet ExplorerNo native support
Not supported
set.isSupersetOf()Recent browsers
Bottom line: Check support with typeof Set.prototype.isSupersetOf === "function". For older browsers, the same result can be made with the spread syntax and filter(), or with a loop.
Frequently Asked Questions
It checks whether the Set contains every value of another Set. It returns true if nothing is missing and false if at least one value is not found.
Yes. An empty Set has no values that could be missing, so isSupersetOf(new Set()) is always true. A Set is also a superset of itself.
They ask the same question from the two sides. big.isSupersetOf(small) is the same as small.isSubsetOf(big). Pick the one that reads more naturally in your code.
Combine the check with a size comparison: a.isSupersetOf(b) && a.size > b.size. This means a has at least one value that b does not have.
Use [...b].every((x) => a.has(x)). It returns true when every value of b is found in a, which is the same answer.