, , :
var timer =1;
var minutes, seconds;
setInterval(function () {
minutes = parseInt(timer / 60, 10);
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
console.log("Form Time: " + minutes + ":" + seconds);
++timer;
}, 1000);
So there might be something that increases the value of the timer or ensures that your startTimer function is called only once.
source
share