这是我的测试代码(在这里小提琴):
console.log('Before wait');
setTimeout(function () { console.log('Yo!'); }, 1000);
var start = Date.now();
while (Date.now() < start + 3000) {}
console.log('After wait');
Run Code Online (Sandbox Code Playgroud)
这是Chrome中事件的时间轴:
这种行为是否符合规范?为什么不呢
?