JavaScript menjalankan sesuatu setelah x detik
setTimeout(function(){
location.reload();
}, 3000); //run this after 3 seconds
SantiBM
setTimeout(function(){
location.reload();
}, 3000); //run this after 3 seconds
setTimeout(function(){
alert("Sup!");
}, 2000);//wait 2 seconds
setTimeout(function(){ alert("Hello"); }, 3000);
setInterval(function(){
console.log("Oooo Yeaaa!");
}, 2000);//run this thang every 2 seconds
var delayInMilliseconds = 1000; //1 second
setTimeout(function() {
//your code to be executed after 1 second
}, delayInMilliseconds);
// wait 1000ms and then run func()
let myTimeout = setTimeout(func, 1000);
// cancel the timeout
clearTimeout(myTimeout);