Get to know MDN better
Since June 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The isSupersetOf() method of Set instances takes a set and returns a boolean indicating if all elements of the given set are in this set.
A Set object, or set-like object.
true if all elements in the other set are also in this set, and false otherwise.
In mathematical notation, superset is defined as:
A⊇B⇔∀x∊B,x∊AA\supseteq B \Leftrightarrow \forall x\in B,\,x\in AAnd using Venn diagram:
Note: The superset relationship is not proper superset, which means isSupersetOf() returns true if this and other contain the same elements.
isSupersetOf() accepts set-like objects as the other parameter. It requires this to be an actual Set instance, because it directly retrieves the underlying data stored in this without invoking any user code. Then, its behavior depends on the sizes of this and other:
The set of even numbers (<20) is a superset of multiples of 4 (<20):
The set of all odd numbers (<20) is not a superset of prime numbers (<20), because 2 is prime but not odd:
Equivalent sets are supersets of each other:
| ECMAScript® 2027 Language Specification # sec-set.prototype.issupersetof |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.