Output every second
Write a function
printNumbers(from, to) that outputs a number every second, starting from
from and ending with
Make two variants of the solution.
- Using recursive
Note that in both solutions, there is an initial delay before the first output. The function is called after
1000ms the first time.
If we also want the function to run immediately, then we can add an additional call on a separate line, like this: