title: Javascript: How do constantly monitor variables value
body: <p>How do I constantly check a variables value. For example:</p>
  
  <pre><code>if(variable == 'value'){
      dosomething();
  }
  </code></pre>
  
  <p>This would work if I constantly looped it or something, but is there an efficient way of triggering that as soon as the variable is set to that value?</p>