title: Same Javascript function not runs one another one it runs parallel
body: <p>This is my code:</p>
  
  <pre><code>var bonusTiles = true
  if (bonusTiles) {
    function myfunc() {
      alert("tet tet");
      removeMatches(bonusTiles, true);
      myfunc1(function test() {
        var bonusTiles = true
        if (bonusTiles) {
          removeMatches(bonusTiles, true);
        }
      });
    }
    myfunc();
  
    function myfunc1(callback) {
      alert("tet tet");
      callback();
    }
  }
  </code></pre>
  
  <p>In the above code, I have called the <code>removeMatches</code> function in <code>myfunc</code> and <code>myfunc1</code>. In this the <code>removeMatches</code> functions in <code>myfunc</code> and <code>myfunc1</code> are running parallel. </p>
  
  <p>I need to run <code>removemaches</code> in <code>myfunc</code> and after it finishes, then run <code>mufunc1</code>.</p>
  
  <p>I used a <code>setTimeout</code> function. It's working but the <code>removemaches</code> function is 
  varying over time.</p>