When is the body of a Promise executed?
Suppose I have the following Promise : function doSomethingAsynchronous() { return new Promise((resolve) => { const result = doSomeWork(); setTimeout(() => { resolve(result); }), 100); }); } At which point in time is doSomeWork() called? Is it immediately after or as the Promise is constructed? If not, is there something additional I need to do explicitly to make sure the body of the Promise is run? Immediately, yes, by specification. From the MDN : The executor function is executed immediately by the Promise implementation, passing resolve and reject functions (the executor is called before