title: Why is callback function executed first in javascript?
body: <p>In the below example. <em>lname</em> is callback function inside <em>fname</em> function. When executed, first output is Smith and the Billy. As per my understanding, callback function <em>lname</em> should be executed once fname function is finished executing. Why am wrong here? </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>function fname(){ console.log("Billy");}
  function lname(){ console.log("Smith");}
  fname(lname());</code></pre>
  </div>
  </div>
  </p>