function sleep(n) { //n表示的毫秒数
var start = new Date().getTime();
while (true) if (new Date().getTime() - start > n) break;
}
console.log(new Date());
this.sleep(3000);
console.log(new Date());