Write a function printNumbers(to, from) that outputs a number every second, starting from to and ending with from. Use setTimeOut function. code example
Example 1: settimeout javascript
setTimeout(function(){
console.log("hello");
}, 3000); //wait for atleast 3 seconds before console logging
Example 2: setinterval vs settimeout js
var intervalID = setInterval(alert, 1000); // Will alert every second.
// clearInterval(intervalID); // Will clear the timer.
setTimeout(alert, 1000); // Will alert once, after a second.
setInterval(function(){
console.log("Oooo Yeaaa!");
}, 2000);//run this thang every 2 seconds