这是js倒计时脚本的写法,写给身为小白的自己
let time = 5;
let playing = false;
playing = setInterval(function(){
time--;
if(time <= 0){
//停止轮询
clearInterval(playing);
}
console.log(time)
}, 1000)
2024-04-02 09:14:46
这是js倒计时脚本的写法,写给身为小白的自己
let time = 5;
let playing = false;
playing = setInterval(function(){
time--;
if(time <= 0){
//停止轮询
clearInterval(playing);
}
console.log(time)
}, 1000)