Only to supplement. If you need to pass a variable and iterate it, you can do just like so:
function start(counter){
if(counter < 10){
setTimeout(function(){
counter++;
console.log(counter);
start(counter);
}, 1000);
}
}
start(0);
Output:
1
2
3
...
9
10
One line per second.