There's more...

In fact, because the results are always resolved with a Promise, async functions can be resolved as a group using Promise.all. You can see an example of async functions with their results joined with a Promise.all:

async function checkEngines(threshold = 0.9) { return Math.random() < threshold; } async function checkFlightPlan(threshold = 0.9) { return Math.random() < threshold; } async function checkNavigationSystem(threshold = 0.9) { return Math.random() < threshold; } Promise.all([ checkEngines(), checkFlightPlan(0.5), checkNavigationSystem(0.75) ]).then(function([enginesOk, flighPlanOk, navigationOk]) { if (enginesOk) { console.log('engines ready to go'); } else { console.error('engines not ready'); } if (flighPlanOk) ...

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.