You might have come across requirement to sleep / delay in javascript. Since we do not have sleep functionality in javascript some overcome the scenario with the help of setTimeout function as detailed in this link. But, how do you do sleep in a loop?
Javascript: Sleep in a loop.
4