Rejects the promise with the specified reason. If the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing.
Optional
reason: anyThe rejection reason for the associated promise. Although the reason can be undefined, it is generally an Error object, like in exception handling.
Note: This argument should not be a promise. Specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.
Fulfills the promise with the specified value. If the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing.
If this value is not a promise, including undefined
, it becomes the fulfillment value of the
associated promise. If this value is a promise, then the associated promise will be resolved to the passed promise,
and follow the state as the provided promise (including any future transitions).
Static
[species]
The promise that can be resolved externally.