Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
unawait interval
const sleep = (ms) => {
setTimeout(() => undefined, ms);
};
const intervalCount = (ms) => {
let counter = 0;
setInterval(() => {
console.log("[Info] count: ", counter)
counter++;
}, ms);
}
const main = () => {
const intervalMs = 3000;
console.log("start!!");
// 3秒毎にカウント
intervalCount(3000);
// 10カウントするまでwait
sleep(intervalMs * 10);
console.log("finish!!");
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.