Skip to content

Commit 3990d6c

Browse files
committed
Challenge jscomplete#2
1 parent 850fa87 commit 3990d6c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

1-getting-started/2-timers/8-challenge2.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@
33
// And stop after 5 times
44

55
// After 5 times. Print "Done" and let Node exit.
6+
let count = 0
7+
8+
const intervalId = setInterval(() => {
9+
console.log("Hello World");
10+
count += 1;
11+
12+
if (count === 5) {
13+
console.log("Limit reached");
14+
clearInterval(intervalId);
15+
}
16+
}, 1000);

0 commit comments

Comments
 (0)