tezvyn:

Promise.then(): Each Call Returns a New Promise

Source: developer.mozilla.orgintermediate

Each `.then()` call returns a new promise, letting you chain async tasks sequentially. This is key for multi-step operations like API calls. The footgun is attaching multiple `.then()`s to the original promise, which executes them in parallel, not in sequence.

Think of `.then()` as a promise factory, not just a callback scheduler. Each call returns a *new* promise, allowing you to build a clean, sequential chain of asynchronous operations. This is the standard way to handle multi-step tasks like fetching user data, then their posts. The common footgun is attaching multiple `.then()` handlers to the *original* promise; this executes them in parallel after the first promise resolves, not sequentially as a chain.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Promise.then(): Each Call Returns a New Promise · Tezvyn