Many browser APIs are asynchronous in nature. This chapter contains recipes for performing basic tasks asynchronously using callback functions, events, and Promises.
Load and show an image. In case of error, show a fallback image.
Call a sequence of Promise APIs, where each depends on the result of the previous.
Load some data using a Promise-based API, and wait for the Promise with the await keyword.
Use Promise.all to run several asynchronous operations in parallel.
Asynchronously animate an element using the requestAnimationFrame API.