Javascript – Behaviour of setInterval with respect to Event loop
Trying to figure out why the output of the following code is the way it is console.log("Start"); setInterval(function() { console.log("setInterval"); }, 5000); let date = new Date(); while(new Date() - date <= 10000) {} console.log("End"); Actual Output Start .... 10…