sleep 関数
Javascript では、標準ではスリープ関数はない為、自作する必要があります。
script.js
const sleep = (time) => {
return new Promise((r) => {
setTimeout(r, time);
})
}
(async () => {
await sleep(5000);
console.log("5秒経過");
await sleep(3000);
console.log("8秒経過");
})();