前端代码睡一下
2023-09-14 本文已影响0人
Phoenixing
前端实现暂停执行,睡一下
const test = async () => {
console.log(111111, +new Date())
const sleep = (ms = 400) => new Promise(resolve => setTimeout(resolve, ms))
await sleep(2000)
console.log(222222, +new Date())
}
test()