function test(){
setTimeout(function(){
var now=new Date();
while((new Date()).getTime() < now.getTime()+5000){ }
console.log('p')
}, 0);
}
test();
test(); //it takes 10 seconds,the second test function runs after the first finished.
有人能解释一下这个是如何工作的吗?