- 1

Wait JavaScript

How do you put a wait in JavaScript?

11th Jan 2018, 3:30 AM
YoBoi
2 odpowiedzi
+ 6
var delayTime = 10000; // 10 secs waiting period setTimeout(delayAlert, delayTime); function delayAlert() { alert("Delay function executed.") }
11th Jan 2018, 3:45 AM
Calviղ
Calviղ - avatar
+ 4
//code before a wait of 2000 ms setTimeout(function(){ //code after the wait }, 2000);
11th Jan 2018, 3:44 AM
Dapper Mink
Dapper Mink - avatar