var timer = null;// typrof timer == 'object';

timer = setInterval(function() {

  //...

}, 1000);//  typeof timer == 'number'

clearInterval(timer);// typeof timer == 'number'

timer = null; // typrof timer == 'object';

 

即在清楚定时器的时候加上timer = null 在开启定时器的时候判断 if(typeof timer  == 'object'){

  //开启定时器

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-01-02
  • 2022-01-07
猜你喜欢
  • 2021-06-26
  • 2021-06-10
  • 2021-09-02
  • 2022-12-23
  • 2021-07-26
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案