- 1
Wait JavaScript
How do you put a wait in JavaScript?
2 Answers
+ 6
var delayTime = 10000; // 10 secs waiting period
setTimeout(delayAlert, delayTime);
function delayAlert() {
alert("Delay function executed.")
}
+ 4
//code before a wait of 2000 ms
setTimeout(function(){
//code after the wait
}, 2000);