(JS bug) Unable to clear Interval as I want in my game Plz help me in my code

In JS line no. 89 https://code.sololearn.com/W3KVNDOGY95I/?ref=app

4/4/2020 8:21:34 AM


2 Answers

New Answer


It seems that the correct gameplay is : Whenever ANY direction button us clicked, clearInterval will clear the current interval, and then a new interval will apply. To do this, use one global variable to store the interval, and add clearInterval at beginning of every event listener. clearInterval Tutorial: https://code.sololearn.com/WgW0wqXU1LXl/?ref=app fix for you: https://code.sololearn.com/WgaoqB2wJCzN/?ref=app


sololearn code compiler is not that good try w3schools js compiler instead. u will get ur problem detect more easily.