I have this code that I can get to out numbers 0 - 9:
var countup = {
i: 0,
startCount: function () {
for(i = 0; i < 10; i++){
console.log(i);
}
}
}
countup.startCount();
now I need to be able to get it to output the numbers at 1 second intervals, I have tried this code below that is just giving me an undefined output:
var countup = {
i: 0,
startCount: function () {
setInterval(function() {
for(i = 0; i < 10; i++){
console.log(i);
}
}, 1000)
}
}
countup.startCount();
Does anyone have have any ideas how I can edit the code above to give the desired output of numbers 0 - 9 at one second intervals?
Thanks!