Checking whether clearInterval has been called?

前端 未结 2 2031
慢半拍i
慢半拍i 2021-02-01 14:35

Given this code:

bob = setInterval(function, 1000);
clearInterval(bob);

Is there now a way to know if that interval has been cleared?

C

2条回答
  •  萌比男神i
    2021-02-01 14:54

    The return value of setInterval is just a unique id you use to pass back to clearInterval. It's not a structured object with any additional information, nor does it get set to null when you call clearTimeout.

提交回复
热议问题