settimeout in jquery code example

Example 1: settimeout jquery

setTimeout(function(){ alert("Hello"); }, 3000);

Example 2: timeout javascript

setTimeout(function(){
 	//code goes here
}, 2000); //Time before execution

Example 3: js settimeout

setTimeout(() => { alert('Hello') }, 1000)

Example 4: settimout jquery

setTimeout(function(){ alert("Hello"); }, 3000);

Example 5: javascipt delay

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

console.log("Hello");
sleep(2000).then(() => { console.log("World!"); });

Example 6: settimeout function

setTimeout(function(){ 
$('#overlay'). modal('hide') 
}, 5000);
//#overlay will be the ID of modal which you want to hide or show modal