Promise.prototype.catch() vs Promise.prototype.finally()
Promise.prototype.catch() and Promise.prototype.finally() 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.catch(): Attaches a handler for rejection. Its syntax is promise.catch(onRejected). Promise.prototype.finally(): Attaches a handler that runs regardless of outcome. Its syntax is promise.finally(onFinally). Example of Promise.prototype.catch(): Promise.reject("err").catch(e => console.log(e)). Example of Promise.prototype.finally(): Promise.resolve().finally(() => console.log("done")). Read the full references for Promise.prototype.catch() and Promise.prototype.finally() to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other Promise APIs worth comparing: Promise.prototype.then(), 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.