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 () {
console.log('Hello world')
}, 1000)
setTimeout(() => {
console.log('Foo bar')
}, 1000)
const now = new Date();
now.setSeconds(now.getSeconds() + 1)
setTimeout(function () {
console.log('Hello world')
}, 1000)
setTimeout(() => {
console.log('Foo bar')
}, 1000)
Run code snippet
function doHomeWork(subject, callback){
setTimeout(callback,500);
console.log("doing my homework:", subject)
}
doHomeWork("Maths", function(){console.log("finished my homework");});
function closeAnimation() {
setInterval(function(){hide()}, 400);
clearInterval(stopAnimation);
}
var stopAnimation = setInterval({hide()}, 400);