is there anything like a sleep function in JavaScript ??? Thank you
Printable View
is there anything like a sleep function in JavaScript ??? Thank you
Hi,
Theres a setTimeout function which works similar to a sleep function but you have to call a function when the time elapses...
Call it like this...Code:function sleep(maximumtim){
setTimeout('endSleep()',maximumtim);
}
function endSleep(){
// code at end ;
}
sleep(5000); will stop for 5 seconds
Hope this helps :)