JavaScript sleep function
Install with npm:
$ npm install --save time-sleepimport sleep from 'time-sleep'
const test = async function() {
console.log(1)
await sleep(1000)
console.log(2)
await sleep(1000)
console.log(3)
}
test()JavaScript sleep function
Install with npm:
$ npm install --save time-sleepimport sleep from 'time-sleep'
const test = async function() {
console.log(1)
await sleep(1000)
console.log(2)
await sleep(1000)
console.log(3)
}
test()