Is there any JavaScript method similar to the jQuery delay() or wait() (to delay the execution of a script for a specific amount of time)?
delay()
wait()
If you only need to test a delay you can use this:
function delay(ms) { ms += new Date().getTime(); while (new Date() < ms){} }
And then if you want to delay for 2 second you do:
delay(2000);
Might not be the best for production though. More on that in the comments