A promise’s resolve function is supplied to its executor to control the promise’s fate. Calling resolve(value) fulfills it with an ordinary value; if value is a thenable—an object with a then method—the promise adopts that thenable’s outcome. Calling resolve with no argument fulfills the promise with undefined. A promise can settle only once. section 8.1.1
Listing 8.2 Resolving promises with other promises
const fulfilledPromise = Promise.resolve("fulfilled"); #A
const rejectedPromise = Promise.reject(new Error("rejected")); #A
const promise1 = new Promise((resolve) => resolve(fulfilledPromise));
const promise2 = new Promise((resolve) => resolve(rejectedPromise));
promise1.then((value) => { #B
console.log(`promise1 was fulfilled with value "${value}"`); #B
}); #B
promise2.then(undefined, (reason) => { #C
console.log(`promise2 was rejected with reason "${reason}"`); #C
}); #C
Resolving with fulfilled or rejected promises shows how resolution adopts the other promise’s outcome. section 8.1.1

