What is the return value of Promise's excutor?

when reading Promise :

var promise1 = new Promise(function(resolve, reject) {
  setTimeout(resolve, 100, "foo");
});
if an error is thrown in the executor function, the promise state is rejected. The return value of the executor function is ignored.

how do you understand the return value of the executor function here?

isn"t Promise supposed to be resolve or reject to execute parameter passing? What is Promise"s executor ?

Mar.01,2021

executor is the parameter of Promise is this anonymous function
these two sentences are to remind you

  1. throwing an error in this anonymous function will change the state to rejected
  2. Don't return things useless in this anonymous function
function(resolve, reject) {}
Menu