function sleep (tm) {
return new Promise(resolve => setTimerout(resolve, tm))
}
sleep(2000).then(() => {console.log('hhah')})
练习手写sleep
最新推荐文章于 2024-05-04 16:49:40 发布
function sleep (tm) {
return new Promise(resolve => setTimerout(resolve, tm))
}
sleep(2000).then(() => {console.log('hhah')})