Reset issue - pomodoro clock project

Hi everyone,

if I reset it will just keep counting down with a different number.
I am quite positive it should work but I have no idea why is like that.

Any tips would be much appreciated, many thanks


Maybe you should use clearInterval on the two intervals running? Also, you have another issue. When you click on STOP and then click on Start again, it does not pick up where it left off. It changes the time completely.

Hi, thanks for taking time to look into that. I am aware of the stop issue but I decided to work on the reset one first.

Unfortunately your hypothesis does not seem right. Can I know why do you suggested the “clearInterval on the two intervals running”?

If you do not clear the intervals, you will have multiple intervals running when you click Start again.

To resolve your issue, I took the following code:

      if (count % 60 >= 10) {
      document.getElementById("display").innerHTML =
        Math.floor(count / 60) + ":" + count % 60;
    } else {
      document.getElementById("display").innerHTML =
        Math.floor(count / 60) + ":" + "0" + count % 60;

and put into a function called displayTime with a parameter call count, that I used anytime the clock’s time needed to be updated (a couple places in your code). Then, I modified your Reset button onclick function to be:

document.getElementById("resetBut").onclick = function resetting(){
   count = 25*60;
   pauseTime = 5;
  document.getElementById("pause").innerHTML = pauseTime;

To clear the intervals outside the Start button click function, you will need to declare myVar and breakkie as global variables and also remove the local declaration of these variables inside the same function.