There is a function that starts another function, at regular intervals, but somewhere after 4 starts, the time starts to increase. Perhaps you need to clear the interval? But for some reason it does not work. After clearing the interval, the function does not start.
Where do I make a mistake?
var car = 7800 timerId = setTimeout(function tick() { AnimateAut() timerId = setTimeout(tick, car); clearTimeout(timerId); }, car);
set Interval()
instead ofsetTimeout()
set Interval()
to periodically execute functions; 3. Why there is no semicolon afterclearTimeout(timerId)
?; 4. What is the stringtimerId
after it? - tutankhamunsetTimeout
-setInterval
- mixtimerId = setInterval(AnimateAut, car);
And note that the intervals insetTImeout()
andsetInterval()
can increase when the browser loads a lot - tutankhamun