event timeout js code example
Example 1: javascript run something after x seconds
setTimeout(function(){
location.reload();
}, 3000); //run this after 3 seconds
Example 2: javascipt delay
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
console.log("Hello");
sleep(2000).then(() => { console.log("World!"); });