Favorites

JavaScript Set.prototype.isSubsetOf() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Set.prototype.isSubsetOf()
JavaScript Set Instance methodThis method is supported by most modern browsers, though support in some browsers is unknown.
Updated 28th November 2026

The isSubsetOf() method checks whether every value in a Set is also in another set.

Description

The isSubsetOf() method returns true if all of this set's values are also in the other set. The related isSupersetOf() checks the reverse, and isDisjointFrom() checks that the sets have nothing in common.

An empty set is a subset of every set, and every set is a subset of itself, so a.isSubsetOf(a) is true. A common use is checking that a user has every permission an action requires.

The argument can be any set-like object, meaning one with a size property and has() and keys() methods, such as another Set or a Map (whose keys are used). Arrays aren't set-like, so wrap them first: new Set(array). The original sets are never changed, and the result keeps the order of the set the method was called on.

Syntax

set.isSubsetOf(other)

Parameters

  • otherAnother Set, or a set-like object.

Return Value

true if every value in this set is also in the other, otherwise false.

Example

const perms = new Set(['read', 'write', 'delete']);
console.log(new Set(['read', 'write']).isSubsetOf(perms));
console.log(new Set(['admin']).isSubsetOf(perms));

Browser Support

The following information will show you the current browser support for the Set.prototype.isSubsetOf() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by most modern browsers, though support in some browsers is unknown.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee