Tunggu satu detik di JavaScript menggunakan async tunggu
function delay(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
async function test() {
console.log('start timer');
await delay(1000);
console.log('after 1 second');
}
test();
MorbidMeta