Combining Generators

Learn how to use yield* to combine generators and iterate over other iterable objects.

In the CardDeck class given in the below code widget, we have two generators:

  1. One to create the suits
  2. The other for pips

It would be a shame if we have to duplicate the code to create a series that contains both suits and pips. Thankfully, we don’t have to endure such pain—JavaScript provides a way to combine generators.

Delegating to

...
Access this course and 1400+ top-rated courses and projects.