Promises
27 bites tagged Promises — interview questions with model answers, and 60-second explainers.
Promise .catch(): Handling Rejections
`.catch()` is the `try...catch` for promises, intercepting errors (rejections) in a chain. Use it at the end of a promise chain to handle failures from preceding steps, like a failed API call. The footgun: placing it mid-chain can swallow errors.
Promise.then(): Each Call Returns a New Promise
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.
JavaScript Promises: Handling Future Values
A Promise is an IOU for a future value from an async operation. Instead of blocking your code, you get an object that will eventually contain the result or an error. They're essential for API calls or file reads.
Get Promises bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.