await sleep(1000) function sleep(ms) { return new Promise((resolve) => { setTimeout(resolve, ms); }); }