Promise.prototype.then() vs Promise.prototype.catch()
Promise.prototype.then() and Promise.prototype.catch() are both JavaScript Promise APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. Promise.prototype.then(): Attaches handlers for the resolved value. Its syntax is promise.then(onFulfilled, onRejected). Promise.prototype.catch(): Attaches a handler for rejection. Its syntax is promise.catch(onRejected). Example of Promise.prototype.then(): Promise.resolve(1).then(x => x + 1) // Promise resolves to 2. Example of Promise.prototype.catch(): Promise.reject("err").catch(e => console.log(e)). Read the full references for Promise.prototype.then() and Promise.prototype.catch() to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other Promise APIs worth comparing: Promise.prototype.finally(), Promise.resolve(), Promise.reject(), Promise.all(), Promise.allSettled(), Promise.race(). Both belong to the Promise category in the JS Reference documentation, which covers 11 entries in total. Try both in the JavaScript playground to see the behavioral difference live.