Javascript Result Of Promise. When we define a promise in JavaScript it will be resolved when the time comes or it will get rejected. Chaining after a catch Its possible to chain after a failure ie.
This is also the same for promises in JavaScript. The main advantage of using a Promise in JavaScript is that a user can assign callback functions to the promises in case of a rejection or fulfillment of Promise. First of all a Promise is an object.
However Deferreds arent PromiseA compliant which makes them subtly different and less useful so beware.
The second argument of then is a function that runs when the promise is rejected and receives the error. The above and JavaScript promises share a common standardized behaviour called PromisesA. When a Promise object is fulfilled the result is a value. The second argument of then is a function that runs when the promise is rejected and receives the error.