Skip to content

Commit

Permalink
Fixed #Q4 async print nums from 1 to 10
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush013 committed Jun 23, 2021
1 parent f32adac commit b068008
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions challenges/async-challenges.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ In the 2nd solution, recursive setTimeout is used.
const num1 = 1, num2 = 10;
let i = num1;
const intervalId = setInterval(() => {
console.log(++i);
if (i === num2)
console.log(i++);
if (i === num2 + 1)
clearInterval(intervalId);
}, 1000);
```
Expand Down

0 comments on commit b068008

Please sign in to comment.