Sleep function in JavaScript
Sometimes during debugging of a loading spinner on the frontend or to test the app behavior by adding delay in a certain function of the application, we need a sleep function just like in multithreaded languages like Java and C#Thread.Sleep(milliseconds).
I found a way to achieve this here in JS.

It will delay the execution for 10000 milliseconds(10 secs) between these two print statements.
thanks 🙌.