Awaiting multiple results concurrently

Sometimes it's possible to initiate multiple asynchronous operations at the same time. This can be desirable, for example, if multiple network requests are necessary in order to fetch all the data for a given page. Waiting for each request to finish before starting the next one wastes time.

In this recipe, we'll see how to use await to initiate and wait for multiple results concurrently.

Get ECMAScript Cookbook 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.