I have a problem, I have performed a function that executes a setInterval
.
The first time the function was called works correctly (every second) but when I call it several times, the time goes out as if it were executing the setInterval
of previous calls.
How can you reset the time so that it always works a second?
function ejecutar_timer(){
var valor = 0;
clearInterval(timerId);
timerId = setInterval(function(){
valor = valor + 1;
}, 1000);
}