This is my test code (fiddle here):
console.log(\'Before wait\'); setTimeout(function () { console.log(\'Yo!\'); }, 1000); var start = Date.now(); while (Dat
Not sure if it could help you but this problem's been explained in: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop#Run-to-completion
For this reason, the second argument indicates a minimum time—not a guaranteed time.