delay in javascript

JavaScript
var delayInMilliseconds = 1000; //1 second

setTimeout(function() {
  //your code to be executed after 1 second
}, delayInMilliseconds);
//code before the pause
setTimeout(function(){
    //do what you need here
}, 2000);var delayInMilliseconds = 1000; //1 second

setTimeout(function() {
  //your code to be executed after 1 second
}, delayInMilliseconds); wait(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
 }//single event i.e. alarm, time in milliseconds
var timeout = setTimeout(function(){yourFunction()},10000);
//repeated events, gap in milliseconds
var interval = setInterval(function(){yourFunction()},1000);setTimeout(function() {
 //your code here
}, 1000);
Source

Also in JavaScript: