Loading topic
new Promise, and that you know a Promise is pending, fulfilled, or rejected. You should also be comfortable with arrow functions and callbacks.3 min readthen and catch, and that you are comfortable with regular and arrow functions. Here we look at what the async keyword does to a function before you use await inside it.2 min readasync function always returns a Promise. The await operator builds directly on both ideas.2 min readtry/catch/finally from synchronous JavaScript, how Promises reject, and how await pauses an async function. It covers what happens when an awaited Promise rejects, and how to handle that failure with the same tools you already use for synchronous errors.3 min readthen and catch, and use await inside an async function. It covers the four built-in combinators. A combinator is a static method that takes an iterable of Promises and returns a single Promise. Each one decides differently when that2 min readawait, and handle errors with try/catch. It also assumes you have seen Promise.all in the chapter on combinators. Here you will learn how the placement of await controls whether independent operations overlap in time or run one after anot2 min readawait pauses a function, and how try/catch handles rejections. It also assumes you know how Promise.all runs work in parallel. Most async bugs come from a small set of mistakes. Each one below has a symptom you can recognis2 min readawait pauses an async function. Here we look at the exact order in which JavaScript runs that queued work. Once you know the rules, you can predict the output of code that mixes await, .then(), 3 min readawait pauses an async function, and how ordinary generator functions (function*) use yield. Some data does not arrive all at once. Paginated API results, lines from a file, and messages from a socket all show up piece by piece. An async generator lets 2 min readawait pauses an async function, how a rejected Promise throws at the await expression, and how to run a file with Node.js. You also need a basic idea of import and export.3 min readasync functions, await, and handling rejections with try/catch/finally, all covered in earlier chapters. You also need Node.js 18 or later, or a modern browser, because both include fetch and AbortController.2 min read