JavaScript tunggu 1 detik
setTimeout(function(){
console.log("Ready")
}, 1000);
Foreverekk
setTimeout(function(){
console.log("Ready")
}, 1000);
function stateChange(newState) {
setTimeout(function () {
if (newState == -1) {
alert('VIDEO HAS STOPPED');
}
}, 5000);
}
function sleep(num) {
let now = new Date();
const stop = now.getTime() + num;
while(true) {
now = new Date();
if(now.getTime() > stop) return;
}
}
sleep(1000)
console.log('delay 1 second');
setTimeout(function () {
// ...
}, 10000);
// or
.then(() => {
// ...
({ timeout: 10000 });
});