Here I use the loop code(learned from What's the equivalent of Java's Thread.sleep() in JavaScript?) to simulate web latency to check my loading animation effect. However, the first line is blocked for 5 seconds too. while the second line(the log statement) isn't. What's happening?
main.innerHTML += '<div id="animation-container"></div>'
console.log("??????????");
var e = new Date().getTime() + (5 * 1000);
while (new Date().getTime() <= e) {}
main.innerHTML += 'real content'