varorderTimeOut=900000;vartimer=setInterval(()=>{orderTimeOut-=10;if(orderTimeOut>10){times=overTime(orderTimeOut);console.log(times)}else{orderTimeOut=0;times="00:00:00";}},10);functionoverTime(time){vara=(time%1000).toString().substr(0,2);varb=Math.floor(time/1000);varm=b%60;m=String(m);m=m.length>=2?m:"0"+m;varf=Math.floor(time/(1000*60));f=String(f);f=f.length>=2?f:"0"+f;returnf+":"+m+"."+a;}这段方法能够正常进行倒计时,但是观察到,它似乎越跑越慢.....
牛魔王的故事
函数式编程
相关分类