Iterators and the for...of loop
Widely available
The for...of
loop operates on a sequence of values sourced from an iterable object, such as arrays, array-like objects, DOM collections, iterators, generators, and user-defined iterables. All built-in iterators inherit from the Iterator
class.
To learn more, see
Iterator,
Iterator.prototype[Symbol.iterator](),
for...of at MDN.
Compatibility
- Chrome 38 Released on 2014-10-07
- Chrome Android 38 Released on 2014-10-08
- Edge 12 Released on 2015-07-29
- Firefox 13 Released on 2012-06-05
- Firefox for Android 14 Released on 2012-06-26
- Safari 7 Released on 2013-10-22
- Safari on iOS 7 Released on 2013-09-18
Specifications
- ECMAScript Language Specification (#sec-%iteratorprototype%-object), from TC39 (Ecma International).
- ECMAScript Language Specification (#sec-for-in-and-for-of-statements), from TC39 (Ecma International).