+ 2

Delay

How can I make a delay in js?

15th Jan 2017, 1:05 PM
tim wong
tim wong - avatar
1 Answer
+ 3
function func() { /* function body */ } var delay = 2500; // millisecondes window.setTimeout( func, delay ); /* rest of code running without waiting execution of 'func' */ If you need to WAIT instead DELAY, you must handle a way to simulate an end event for your function...
15th Jan 2017, 1:19 PM
visph
visph - avatar