javaScript倒計時

//倒計時
let timeinterval="";
let countDownStart="";
countDown(timeTotal) {
timeinterval = setInterval(() => {
    timeTotal--;
    countDownStart = timeTotal + "秒";
    if (timeTotal <= 0) {
        clearInterval(this.timeinterval);
        countDownStart = "倒計時開始";
    }
}, 1000);
}
countDown(60);
相關文章
相關標籤/搜索