This chapter introduced you to the concept of generators, a new construct as of ES6, which allow us to implement lazy evaluation. Generators help us realize the conserve concurrency principle because we can avoid computations and intermediary memory allocations. There are a few new syntax forms associated with generators. First, there's the generator function, which always returns a generator instance. These are declared differently than regular functions. These functions are responsible for generating values, which rely on the yield
keyword.
We then explored more advanced generator and lazy evaluation topics, including deferring to other generators, implementing map/reduce functionality, and passing data into generators. We closed the chapter with a look at how to use generators to make coroutine functions.
In the following chapter, we'll look at web workers—our first glimpse at utilizing parallelism in the browser environment.