interval and timeout both in javascript code example
Example 1: settimeout function
setTimeout(function(){
$('#overlay'). modal('hide')
}, 5000);
//#overlay will be the ID of modal which you want to hide or show modal
Example 2: javascipt delay
async function delay(delayInms) {
return new Promise(resolve => {
setTimeout(() => {
resolve(2);
}, delayInms);
});
}
async function sample() {
console.log('a');
console.log('waiting...')
let delayres = await delay(3000);
console.log('b');
}
sample();