Skip to content
Advertisement

Tag: clearinterval

ClearInterval doesn’t work. What is the problem? How can I solve it?

https://codepen.io/fodi91/pen/ExNqGpY First I click the random background every 4 seconds button, then I click the random background onclick button, but the interval doesn’t stop. Why? How can I solve this? Answer There are a couple of issues with your code. Firstly, you need to declare your myInterval variable outside of the generator2() function. The second issue is that your interval

SetInterval does not work well after some actions

When I press Start button it runs In my game it moves blocks from top to bottom each second. Also I have a laser which shoots and destroy blocks. When you press space key it use another laserId = setInterval(moveLaser, 100) Before you press space key blocks move well each second, but after using lazer blocks move faster then 1

Advertisement