Summary
Iterators are objects that implement the Iterator protocol by having a next() method that returns an object with two properties: value and done. Arrays have a @@iterator method that implements the iterable protocol and allows them to be consumed by syntaxes expecting iterables, such as the spread syntax and for...of loops. Iterators allow you to iterate over an object, such as arrays, Map objects, and even strings.
1
2
3
According to
See more results on Neeva
Summaries from the best pages on the web
Summary
As the name already gives away, iterators allow you to iterate over an object (arrays are also objects).
Most likely, you have already used JavaScript iterators. Every time you iterated over an array, for example, you have used iterators, but you can also iterate over Map objects and even over strings.
JavaScript iterators and generators: A complete guide - LogRocket Blog
logrocket.com
To make the range object iterable (and thus let for..of work) we need to add a method to the object named Symbol.iterator (a special built-in symbol just for ...
Iterables
javascript.info
21.3.8.1 How to iterate over properties # The proper (and safe) way to iterate over properties is via a tool function. For example, via objectEntries() , whose ...
21. Iterables and iterators
exploringjs.com