What is the output of the following? “`js const p = Promise.reject(42); p.catch(v => v + 1).then(console.log); “`

JavaScript Developer Hard

JavaScript Developer — Hard

What is the output of the following? “`js const p = Promise.reject(42); p.catch(v => v + 1).then(console.log); “`

Key points

  • The catch handler modifies the rejected value before passing it to the next then block
  • The value passed to the then block is the modified value
  • The console.log function outputs the final modified value

Ready to go further?

Related questions