title: Javascript callback function not executing as intended
body: <p>According to this stackoverflow <a href="https://stackoverflow.com/a/30827265/2875210">answer</a>, </p>
  
  <blockquote>
    <p>functions passed as parameters are always callbacks, even if the intention is that the function is called synchronously...</p>
  </blockquote>
  
  <p>and I've learned the event loop mechanism which basically says that call back functions are push into a waiting queue and executed after synchronous code finishes(stack empty), however in the following code </p>
  
  <pre><code>function myfun(a, b, callback) {
      console.log(a);
      callback();
      console.log(b);
  }
  
  function cb() {console.log('hi')}
  
  myfun(1, 2, cb)   // result: 1 hi 2
  </code></pre>
  
  <p>the result is not <code>1 2 hi</code> as I expected, from which I infer that only callback functions that fire some 'event signal' like <code>setTimeout</code> will be pushed into such queue but I can't find concrete reference to support it? </p>