While examining the static methods of the Promise constructor, I noticed that there are two methods called resolve and reject:
console.log(Object.getOwnPropertyNames(Promise))
// Array(7) [ "all", "race", "reject", "resolve", "prototype", "length", "name" ]
I started wondering whether these resolve and reject methods are the same ones used as parameters in the executor function, or if they are separate entities altogether:
const myFirstPromise = new Promise((resolve, reject) => {
// do something asynchronous which eventually calls either:
//
// resolve(someValue); // fulfilled
// or
// reject("failure reason"); // rejected
});
The specification talks about Promise Resolve Functions and %Promise_resolve% intrinsic object known as Promise.resolve ( x ). Can someone clarify if these refer to the same thing?