JavaScript Promise catch()
Description
The catch() method provides a callback.
The callback is a function to run when a promise is rejected.
Syntax
promise.catch(rejected())
Parameters
| Parameter | Description |
| rejected() | Function to run when the promise is rejected |
Return Value
| Type | Description |
| Object | A new Promise Object |
Promise Methods
Static Methods
Promise.all()
Promise.allSettled()
Promise.any()
Promise.race()
Promise.reject()
Promise.resolve()
Promise.try()
Promise.withResolvers()
See Also:
Browser Support
catch() is an ECMAScript6 (ES6 2015) feature.
JavaScript 2015 is supported in all browsers since June 2017:
| Chrome 51 |
Edge 15 |
Firefox 54 |
Safari 10 |
Opera 38 |
| May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |