DEV Community

Discussion on: Sleep function in javaScript

Collapse
 
ats1999 profile image
Rahul kumar

Supposed in case, where you want to use sleep many times. If code goes long, say 1000 lines of code. In this case, it becomes hard to manage the code.
Here we can just use,

await sleep(ms);
// do after sleep();
Enter fullscreen mode Exit fullscreen mode
Collapse
 
ats1999 profile image
Rahul kumar

code and sleep 🥱