我會很感興趣,我可以如何清除這些間隔。我已經嘗試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