setTimeout(function(){
$('#overlay'). modal('hide')
}, 5000);
//#overlay will be the ID of modal which you want to hide or show modal
setTimeout(command, time);
//if you find the answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
function func() {
this.var = 5;
this.changeVar = function() {
setTimeout(() => { //Don't use function, use arrow function so 'this' refers to 'func' and not window
this.var = 10;
}, 1000);
}
}
var a = new func();
a.changeVar();
// setTimeout() Method in javascript
function setTimeoutFunction() {
setTimeout(function(){ console.log("This message will display after 5 seconds"); }, 5000);
}
setTimeoutFunction();
// program that shows the delay in execution
function greet() {
console.log('Hello world');
}
function sayName(name) {
console.log('Hello' + ' ' + name);
}
// calling the function
setTimeout(greet, 2000);
sayName('John');