Bereaksi keadaan setel waktu asli

export const delay = (ms) => new Promise((res) => setTimeout(res, ms));
// do something
await delay(500); // wait 0.5 seconds
// do something else
Puzzled Puffin