Hello, my name is JP.
Javascript Sleep Method
Languages like Java and Ruby have native sleep functions. Regardless on the opinion around using a sleep method, it is nice to have a sleep helper method in JS.
If you're interested in having a sleep utility method, here is how you can do it:
There are couple of things to note about this implementation.
First, notice that the method uses async/await. So to use the sleep method it needs to be inside an async function and you must await the sleep() method.
That's about it. A one liner and nice little utility.