Timer deactivating after button click

Student is attempting to deactivate the timer by clicking an answer. Problem is - timer does not stop.

We would love to help, but the link shared in your post just goes to the Code.org dashboard. You’ll need to use the “share” link for the project in question so we can access the code to help debug.

Hello I am the student in this scenario. Here is my thing App Lab - Code.org

your redeclaring time4 locally which will not be assigned to the global one this means that it will clear the timeout id 0 rather than the id that was returned via the setTimeout hope this helps

correct = correct + 1;
  setScreen("Question4");
  playSound("RPReplay_Final1696930121.mp3", true);
  endTime4 = setTimeout(function() { // this is it
    stopSound("RPReplay_Final1696930121.mp3");
    setScreen("GameOver");
    playSound("Scary1.mp3", false);
    playSound("Scary2.mp3", true);
    hideElement("button1");
    setTimeout(function() {
         showElement("button1");
      }, 3000);
  }, 7000);

for next time you should label the issue via comments of where the error is to help any future people be guided in the direction, on the bright side i learned a lot more about Thomas the tank engine and will continue to reflect on these thoughts very good triva app