标签:
大家看下如下代码,猜猜执行结果:
var start = new Date;
setTimeout(function(){
console.log(‘时间流逝了:‘+(new Date - start)+‘毫秒‘);
}, 200);
while (new Date - start < 1000) {}
console.log(1);
function doSoming(){
setTimeout(function(){
console.log(‘时间又流逝了:‘+(new Date - start)+‘毫秒‘);
},10);
}
doSoming();
while (new Date - start < 2000) {}
console.log(2);
标签:
原文地址:http://www.cnblogs.com/susufufu/p/5759480.html