Javascript – Difference between setTimeout(fn,0) vs setTimeout(fn,1)
I have this bit of code: setTimeout( () => console.log("setTimeout callback is complete"), 0); fetch("https://api.coingecko.com/api/v3/ping") .then(() => console.log("fetch callback is complete")); // busy-wait for a few seconds: for (let i = 0; i < 1000000; i++) { for (let j…