I have a function set up like this
awesomeFirePenguin: function(){
// function does some stuff, not important
},
and I call it in a for loop like this
for (var i = 0; i < n; i++){
this.awesomeFirePenguin();
}
This works, the function is called n
times, but the results of the function are shown immediately after each other. What I want is for the results to be shown after each other with a slight delay, like 100ms or so. Something klike this
for (var i = 0; i < n; i++){
this.awesomeFirePenguin();
// wait a while and then continue
}
I tried using
for (var i = 0; i < n; i++){
window.setTimeout(this.awesomeFirePenguin(), 100);
}
and window.setInterval(this.awesomeFirePenguin(), 100);
, but both only execute the function once.