[removed] How do constantly monitor variables value

前端 未结 6 2403
无人共我
无人共我 2021-02-14 08:36

How do I constantly check a variables value. For example:

if(variable == \'value\'){
    dosomething();
}

This would work if I constantly loope

6条回答
  •  别那么骄傲
    2021-02-14 09:00

    Use setInterval:

    var key = ''
    setInterval(function(){
      if(key == 'value'){
        dosomething();
      }
    }, 1000);
    

提交回复
热议问题