coderef

Array iteratorsBaseline · Widely available

Arrays are iterable with the for … of statement and enumerable with the methods entries(), keys(), and values().

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since May 9, 2018. Widely available since Nov 9, 2020.

Browser support

DesktopChrome
1–65Not supported
66+Supportedsince Apr 17, 2018
Current: 155
Edge
12–13Not supported
14+Supportedsince Aug 2, 2016
Current: 154
Firefox
1–59Not supported
60+Supportedsince May 9, 2018
Current: 157
Safari
1–9.1Not supported
10+Supportedsince Sep 20, 2016
Current: 27
MobileChrome Android
18–65Not supported
66+Supportedsince Apr 17, 2018
Current: 155
Firefox Android
4–59Not supported
60+Supportedsince May 9, 2018
Current: 157
Safari iOS
1–9.3Not supported
10+Supportedsince Sep 13, 2016
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: Symbol.iterator.

Feature detection

JS · check before using
if ("@@iterator" in Array || ("prototype" in Array && "@@iterator" in Array.prototype)) {
  // Array.@@iterator is available
}

Sub-features

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

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Array.@@iterator38123610383610
Array.entries381228838288
Array.keys381228838288
Array.values661460966609