© Raju Gandhi 2019
R. GandhiJavaScript Nexthttps://doi.org/10.1007/978-1-4842-5394-6_15

15. Asynchronous Iterators and Generators—A Meeting of the Minds

Raju Gandhi1 
(1)
Columbus, OH, USA
 

The idea of generators is tempting, and it tends to spoil us. We are no longer afraid to work with large or infinite sequences and streams. However, while generators are great at working with values, they were never designed for working with promises.

In this chapter, we will see yet another reconciliation—one that merges the syntax of generators with async and await, to give us asynchronous generators, and iterators.

The Impedance Mismatch Between Generators/Iterators and Asynchronous Operations

ES6 introduced us to iterables, the well-known symbol Symbol.iterator ...

Get JavaScript Next: Your Complete Guide to the New Features Introduced in JavaScript, Starting from ES6 to ES9 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.