function delay(n) {
return new Promise(function(resolve) {
setTimeout(resolve, n * 1000);
});
}
async function myAsyncFunction() {
// Do what you want here
console.log('Before the delay')
await delay(5);
console.log('After the delay')
// Do what you want here too
}
myAsyncFunction();
利用 await 来实现同步等待
ubistaddft
看的我热血沸腾啊www.jiwenlaw.com
fdgqdwhupq
想想你的文章写的特别好https://www.ea55.com/
gfssslyylg
看的我热血沸腾啊https://www.jiwenlaw.com/
tpuviijxys
叼茂SEO.bfbikes.com
tybtdfxxna
博主真是太厉害了!!!