title: Wait until variable equals
body: <p>I am trying to check if a variable is equal to 1 using javascript...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>myvalue = 1;
  
  function check() {
      if (myvalue == 1) {
          return setTimeout(check, 1000);
      }
  
      alert("Value Is Set");
  }
  
  check();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am planning on adding a delay to the setting of the variable but for now why is this simple version not working?</p>