setInterval going too fast
问题 I'm new to JS, and decided to start of learning by a making a small game. I am using a setInterval to automate the enemy's attack. For their first attack the interval is correct, but after the second attack it speeds up to attacking almost three times, or more, a second. I'm also having trouble stopping the interval once either the player's or the enemy's health reaches 0. here is pretty much all the code pertaining my problem. The whole code can be found here function deadFunct(){ if