我会很感兴趣,我可以如何清除这些间隔。我已经尝试clearInterval()但它没有工作不要喊我,我是新的JavaScript。如果你能清除这些间隔,我会很开心。称为gameOver()的函数应该阻止它们。清除间隔javascript
function startGame(){
spawnLadybug();
newGame();
clearInterval();
setInterval(function(){moveLadybug()}, 250);
setInterval(function(){spawnWall()}, 5000);
spawnFood();
}
您是否阅读过文档,其中解释了如何做到这一点? – SLaks 2014-09-21 17:08:23
我在呐喊! ;) – achedeuzot 2014-09-21 17:08:37
可能重复的[setInterval和如何使用clearInterval](http://stackoverflow.com/questions/5978519/setinterval-and-how-to-use-clearinterval) – ShaneQful 2014-09-21 17:12:21