My loop doesn't wait for the sleep to finish before continuing the loop. How can I make it so?
const a = [1,2,3,4,5]
function sleep() {
return new Promise(resolve => setTimeout(resolve, 1500))
}
a.forEach(async num => {
await sleep()
console.log('Number:', num)
})