JavaScript Promise Example | JavaScript Promises | Promise.all() | Promise.race()

In JavaScript we uses promises for handling async API calls.  In JavaScript the  Promise takes one argument as a callback containing 2 parameters resolve and reject.

If promise is fulfilled the resolve function will be called and if promise is not fulfilled  reject function will be called.

Let me explain with some example:

Here in this example I have defined 2 promises one is classResult and other is gotMedal. classResult and gotMedal returns promises. If promise resolved then code block executes else catch code block executes. ...  Read More

Share This: