const sleep=(t)=>{
return new Promise(resolve=>setTimeout(resolve,t))
}
function test(){
console.log('1');
sleep(1000).then(()=>{
console.log('1秒后输出的内容');
})
}
function sleep(time) {
const startDate = (new Date()).getTime()
while((new Date()).getTime() - startDate < time) {
continue;
}
}
function test(){
console.log('111');
sleep(3000);
console.log('222');
console.log(`sleep exe ending!`);
}