Theoretical example regarding .then() syntax...
Why doesn't it wait for the second call to resolve before calling the third?
// Waits ms milliseconds then resolves
const fn = (ms) => {
return new Promise((res, rej) => {
setTimeout(()=>res(console.log(`Resolved after ${ms} ms delay`)), ms);
});
}
console.log(`calling fn #1`);
fn(2000).then(()=>{
console.log(`calling fn #2`);
fn(2000);
}).then(()=>{
console.log(`calling fn #3`);
fn(2000);
});
question from:https://stackoverflow.com/questions/65853813/javascript-then-chain-not-queued-up