`Promise.resolve` and the Promise executor function's `resolve` argument lets you "delegate" the fulfillment of the given promise to another promise object. That is essential for composability.
In the other hand, `Promise.reject` and the Promise executor function's `reject` argument are to be called at the point when the given operation fails and you already have enough info to reject it with a `reason` (that is, `reject` is similar to a `throw` when compared to non-async code). In this context, it wouldn't make much sense to delegate the failing of a promise, since reject is always called when you're 100% positive that the operation has already failed. Just like `throw`, you can pass any object as the `reason` argument to `reject()`, but good practices tell you to only pass error objects. /FM
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

