The increment of the function value in the setInterval method in JS is incorrect.

defines a value in the setInterval () method so that
x-= 1;

 secondLength = 60;
 setInterval(function(){
     console.log(secondLength);
     secondLength -= 1;
     setDefault(secondtx,secondLength)
    },1000);

looks like this. It is correct in the first run. The value of secondLength decreases by 1 per second, and decreases by 2 per second on the second run. For some reason, the specific program is a little long, which I used when writing a countdown.
Codepen code: https://codepen.io/GoodNetize.
turn to the bosses. This is a cripple, because I can"t seem to write it, and I don"t know how to write it next. It is written after the effect of this clock.
imitate this: https://codepen.io/Khatybov/p.

Mar.07,2021

The probable reason for this

is that the second time your timer code is opened, it is a duplicate declaration. You can ask the timer id

before each declaration.
clearInterval(id) ;
id = setInterval(function(){},1000);


 secondLength = 60;
 clearInterval(timer);
 var timer = setInterval(function(){
     console.log(secondLength);
     secondLength -= 1;
     setDefault(secondtx,secondLength)
    },1000);
Menu