Loading topic
setTimeout. It also assumes the previous chapter's model: a promise starts pending and settles once, as either fulfilled or rejected. Here you will see how to build that object yourself with th2 min readnew Promise. You will see .then and .catch used to print results. The next chapter covers them in full.2 min readnew Promise or Promise.resolve. Here you will learn how to run code once a promise settles.2 min readthen. It also assumes you are comfortable with arrow functions and setTimeout. Here you will learn the rule that turns single handlers into multi-step pipelines: **every call to then returns a new pr2 min readthen, and that each then returns a new promise that settles with whatever its handler returns.2 min readthen and catch, and follow how a rejection travels down a chain. Everything here builds on those skills.2 min readthen, and that you know how a thrown error skips ahead to the nearest catch. It also uses Promise.all from the previous chapter. async and await add no new machinery. They are syntax on top of the promises you already know, and every r2 min readthen handlers, and write async functions. It also assumes you know that setTimeout schedules a callback for later. The goal here is to predict the exact order in which your callbacks run.2 min readnew Promise, how then and catch consume one, and how async/await works. You also need Node.js to run the examples, since they use its fs and util modules.2 min readcatch handles errors in a chain and how async functions return promises. It also assumes you can run code in Node.js or a browser console.2 min readthen calls, how errors travel through a chain, and that promise callbacks run as microtasks. In earlier chapters, returning a promise from a then handler made the chain wait for it. That waiting is called adoption, and it works for any object wi2 min readcatch handles errors, how Promise.all works, and how to write async functions with await. Most promise bugs don't throw errors. The code runs, but in the wrong order, too slowly, or with a value of undefined. T2 min read