coderef

Set (initial support)Baseline · Widely available

Set objects store unique values of any type.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.

Browser support

DesktopChrome
1–37Not supported
38+Supportedsince Oct 7, 2014
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1–12Not supported
13+Supportedsince Jun 5, 2012
Current: 157
Safari
1–7Not supported
8+Supportedsince Oct 16, 2014
Current: 27
MobileChrome Android
18–37Not supported
38+Supportedsince Oct 8, 2014
Current: 155
Firefox Android
4–10Not supported
14+Supportedsince Jun 26, 2012
Current: 157
Safari iOS
1–7Not supported
8+Supportedsince Sep 17, 2014
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: Set.

Feature detection

JS · check before using
if (typeof Set !== "undefined") {
  // Set is available
}

Sub-features

Support for each part of the feature (16). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Set381213838148
Set.@@iterator431236943369
Set.@@species51134110514110
Set.Set381213838148
Set.Set.iterable_allowed381213938149
Set.Set.null_allowed381237938379
Set.add381213838148
Set.clear381219838198
Set.delete381213838148
Set.entries381224838248
Set.forEach381225838258
Set.has381213838148
Set.key_equality_for_zeros381229938299
Set.keys381224838248
Set.size381219838198
Set.values381224838248