Advertisement

Handle a Rejected Promise with catch, Learn ES6 on freeCodeCamp 2020

Handle a Rejected Promise with catch, Learn ES6 on freeCodeCamp 2020 In this lesson, from freeCodeCamp's ES6 Challenges we continue learning about promises. In this ES6 tutorial, we look at handling rejected promises in js. At times, when we use a promise in javascript, the promise will not resolve successfully. Whenever a promise is rejected, we are able to handle the rejected promise with a .catch method. The .catch method will throw an error. We then are able to do something with this error, like log something out for the user to see. Our promise will have some code to run if the promise is resolved successfully and a catch if the promise is rejected.

promises in js,js promises tutorial,learning js promises,.catch promises,promises .catch,

Yorum Gönder

0 Yorumlar