« Previous Next » Iterators and Generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of for...of loops. For details, see also: Iteration protocols for...of function* and Generator yield and yield* In JavaScript an iterator is an object which defines a sequence and potentially a return value upon its termination. Specifically
![Iterators and generators - JavaScript | MDN](https://cdn-ak-scissors.b.st-hatena.com/image/square/aa767575b4232d312d2c5de428f0bf0955805e26/height=288;version=1;width=512/https%3A%2F%2Fdeveloper.mozilla.org%2Fmdn-social-share.cd6c4a5a.png)