Promise.all()
source:
const times = [2000, 500, 3000, 1000]
await Promise.all(times.map(async t => {
await stop(t)
console.log(t)
}))
output:
500
1000
2000
3000
source:
const times = [2000, 500, 3000, 1000]
await Promise.all(times.map(async t => {
await stop(t)
console.log(t)
}))
output:
500
1000
2000
3000