I am trying to get my countdown to stop at zero however it resets rather than stops.
I've added a conditional statement at the end of the runTimer function but nothing happens. It just resets.
I'm going off of an exercise where it counts up. I'm modifying it a bit and having it countdown.
function runTimer() {
let currentTime = leadingZero(timer[1]) + ":" + leadingZero(timer[2]);
theTimer.innerHTML = currentTime;
timer[3]--;
timer[0] = Math.floor((timer[3]/100)/60); //minutes
timer[1] = Math.floor((timer[3]/100) - (timer[0] * 60)); //seconds
timer[2] = Math.floor(timer[3] - (timer[1] * 100) - (timer[0] * 6000)); //hundredths
if (currentTime = 0) {
clearInterval(interval);
}
}
I expected it to stop at zero but it just resets back to 59:00... and I want it to stop at 00:00.