Promises and async/await

A promise is a value that arrives later, like the buzzer a restaurant hands you. Learn then, catch and finally, write the same thing more clearly with async and await, handle errors, and wait for several things at once.

Updated

Promises in JavaScript

  1. Promises: then, catch and finally (Journeyman): A promise is a value that arrives later, like the buzzer a pizza shop hands you, and then, catch and finally say what to do when it works, when it fails, and either way.
  2. async and await (Journeyman): async and await let you write code that waits for promises as if it were a recipe, one step under another, with try and catch for the steps that fail.
  3. Waiting for Several Things at Once (Freelancer): Promise.all, Promise.allSettled, Promise.race and Promise.any start several slow jobs together and wait for all of them, every answer, the first to finish or the first success.

Exercise: Pizza Order Tracker

  1. Exercise: Pizza Order Tracker (Journeyman): Write the order tracker for a busy pizza shop with async and await, Promise.all and Promise.any, from one order through the oven to the fastest free driver, and let the tests check each piece.