JS Built-ins
AsyncPatternsbeginner

.catch returns a Promise

πŸ“– Usage Example
const p = Promise.reject('oops').catch(err => err + ' handled');
// resolves to 'oops handled'

.catch() handles a rejection and returns a new resolved Promise.

Promise.catch()

.catch() attaches a rejection handler and returns a new Promise.

Challenge: Verify that .catch() returns a Promise instance.

πŸ’‘ Hints (3)
  • β€’ .catch() returns a new Promise.
  • β€’ It handles rejection and transforms it.
  • β€’ The returned Promise can be resolved or rejected depending on the handler.