js 实用方法
1、倒计时
const countDown = (second) => { const s = second % 60; const m = Math.floor(second / 60); return
${00${m}
.slice(-2)} : ${00${s}
.slice(-2)};};let time = 5 * 60;const timer = setInterval(() => { const show = countDown(time--); console.log(show); if(time < 0) { console.log('倒计时结束!'); clearInterval(timer); }}, 1000);