title: do something if variable changes
body: <p>I want to disable button if user didnt add anything into global variable "code". I tryied indexOf() however it is reactive only once. Lets say if i have button that adds "z" into "code" global variable, it does not execute function inside indexOf("z"); Can anybody help?</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>let code = "";
  
  $(document).ready(() =&gt; {
        function codeCheck() {
          if (code = "") {
            console.log("nothing")
          } else if (code.indexOf("z")) {
            console.log("do semething")
          }
        }
  
        code = "z";
        codecheck();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>