ES6 Generators

A Generator can be used as the iterator object of another object to comply with Iteration Protocols. It can be defined using function* and yield as shown below


As an iterator of an object

It is possible to call one generator from another one using yield*. See the example below.

Share