title: pass nested callbacks as argument javascript?
body: <p>I have a block of code like that</p>
  
  <pre><code>function doA (callback) {
      //do something...
      callback();
  }
  
  function doB (callback) {
      //do something...
      callback();
  }
  
  function doC () {
      //do something...
  }
  </code></pre>
  
  <p>i know it's a bad practice and have to avoid it, but i am trying to understand why when i called the functions as</p>
  
  <pre><code>doA(doB(doC)));
  </code></pre>
  
  <p>it throwed an error that "callback is not a function" ?
  But when i tried:</p>
  
  <pre><code>doA(doC);
  </code></pre>
  
  <p>everything was ok.</p>
  
  <p>edited: i have tried to use chrome dev tool to figure out how javascript callstack works here, and i found out that the call stack be like:</p>
  
  <pre><code>doC
  doB
  </code></pre>
  
  <p>there isn't doA function, so why js avoids adding doA() to the callstack?</p>