Chapter 5. ES6 Iterators and Generators

So far, we have discussed language constructs of JavaScript without looking at any specific language version. In this chapter, however, we will primarily focus on a few language features introduced in ES6. These features have a big impact on how you write JavaScript code. Not only do they improve the language significantly, they also offer several functional programming constructs unavailable to JavaScript programmers thus far.

In this chapter, we will take a look at newly introduced iterators and generators in ES6. With that knowledge, we will proceed to take a detailed look at the enhanced Collections constructs.

For...of loop

For...of loops are introduced in ES6 along with the iterable and iterator constructs. ...

Get Object-Oriented JavaScript - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.