What's the difference between using reject and return reject in Promise's internal functions

can be run in Chrome. The program details are shown below:

clipboard.png

will the current task queue be rolled back to the status of the Project sibling as soon as you execute reject,?

Mar.19,2021

return reject has no special meaning. Promise makes Promise complete or failed through resolve and reject . Your return reject ('2') is executed reject ('2') and pops out.
if you return in advance, it will cause the Promise to be pending state.


return will jump out of the function, not return. If you have code after reject, it will be executed


here reject is a function. What is your function definition?


there is no difference, the same as the answer of the previous two bigwigs. Is to interrupt the execution of the current function. If there is no return, it will continue later, if there is no effect when rej/res is executed.

new Promise((res,rej)=>{
    res();
    console.log(1);
    rej();
    console.log(2)
})

Direct output: 1. And this is the resolve state.

Promise{<resolved>: undefined}
Menu