1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 23:59:59 -05:00
denoland-deno/tests/specs/run/top_level_await/tla3/timeout_loop.js

24 lines
311 B
JavaScript
Raw Normal View History

2024-11-05 01:39:05 -05:00
export const foo = "foo";
export function delay(ms) {
return new Promise((res) =>
setTimeout(() => {
res();
}, ms)
);
}
let i = 0;
async function timeoutLoop() {
await delay(1000);
console.log("timeout loop", i);
i++;
if (i > 5) {
return;
}
timeoutLoop();
}
timeoutLoop();