why I got the error: wait is only valid in async function
const sleep = async ((ms) => {
new Promise(res => setTimeout(res, ms))
})
const test1 = async (() => {
await sleep(1000)
})
await test1()
Thanks !
why I got the error: wait is only valid in async function
const sleep = async ((ms) => {
new Promise(res => setTimeout(res, ms))
})
const test1 = async (() => {
await sleep(1000)
})
await test1()
Thanks !