1 min read

Sleep function

An asynchronous task continuing after a timed pause.

Sleep function

when you need to delay some code async await before running.

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

// await sleep(200); // 200 millisecond