I would like to know how js promises work internally.
I've googled but I couldn't find the answer (or I didn't know how to google).
I don't know how it gets back to you.
Lets say I have this client code:
function whatever() {
doSomethingLocally;
callPromiseThatGoesAllOverTheWorldAndThenGetsBackToYou()
.then(
doSomethingLocallyAgain
);
doSomeOtherThingLocally;
}
I would like to know how, when the promise is fulfilled, it gets back to the right point in code (that 'doSomethingLocallyAgain').