-3
I need to make a loop where at each iteration it wait 2 seconds until the next. I tried with setInterval, but saw that it does not work as I want... For it is asynchronous, so the loop runs normal, just calling the set interval that runs in its time... as I do so that there is a delay in each iteration?
function I did and does not work as accurate:
while ((!this.service.levelsLoaded)) {
setInterval(function() { }, 2000);
}
What exactly do you need done? The snippet of code you put in is very small and doesn’t help with the answer... Try [Edit] your question to put more details.
– Luiz Felipe
ops I put if instead of while... and I need every iteration of while it gives like a Sleep... the way it is, it waits 2 seconds and then fires everything
– daniely