// 函数实现,参数单位 毫秒 ;
function wait(ms) {
return new Promise(resolve => setTimeout(() => resolve(), ms));
};
async function foo() {
// 调用方法;
await wait(5000);
console.log('休眠了吗');
}
foo()
// 函数实现,参数单位 毫秒 ;
function wait(ms) {
return new Promise(resolve => setTimeout(() => resolve(), ms));
};
async function foo() {
// 调用方法;
await wait(5000);
console.log('休眠了吗');
}
foo()