- Code which doesn't cause stack overflow
const s = async () => {
await new Promise((resolve) => {
setTimeout(resolve, 1);
});
await s();
console.log("exit");
};
s();
- Code causes stack overflow
const s = async () => {
await s();
console.log("exit");
};
s();
Question:
case 2 causing stack overflow is what i have expected, what i don't understand is what why case 1 won't. Please help me with this.