You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If then is a function, call it with ... first argument resolvePromise, and second argument rejectPromise, where:
a. If/when resolvePromise is called...
b. If/when rejectPromise is called...
c. If both resolvePromise and rejectPromise are called, or multiple calls...
d. If calling then throws an exception e...
But what if then neither throws an exception nor calls one of its arguments? It may simply do nothing and return. Probably a rare case, but it looks like an omission to me. Or am I missing something?
The text was updated successfully, but these errors were encountered:
Let's assume the original promise (which we should denote by the object promise) will eventually settle (that is, get resolved or rejected).
Then if you have set up the promise like promise.then(onResolve, onReject), then either of onResolve or onReject is called depending on the state of promise (if it's not a function, then the new promise will be equivalent to the old one), with the sole argument being the value or reason of the original promise. The resulting function may either return or throw, and returning will resolve the new promise, while throwing will reject the new promise.
Returning without any value is equivalent to returning void 0 (AKA undefined); in this case the new promise is fulfilled with the value undefined.
In The Promise Resolution Procedure step 3.iii, cases a through d are considered:
But what if
then
neither throws an exception nor calls one of its arguments? It may simply do nothing and return. Probably a rare case, but it looks like an omission to me. Or am I missing something?The text was updated successfully, but these errors were encountered: