title: Passing function as callback without argument - need help to understand it
body: <p>I've seen a code sample like that in some tutorial:</p>
  <pre><code>getSomething(function onSomething(name) {
    return renderSomething(name);
  });
  </code></pre>
  <p>And that it is equal to the following:</p>
  <pre><code>getSomething(renderSomething);
  </code></pre>
  <p>I'm a newbie, and never seen anything like this before. I can't really understand how the above can be the same(without parameter on the <code>renderSomething()</code>).
  I've tried to recreate something similar to the above code to better understand it and kind of failed. I'm showing you what I've tried and hopefully you can explain to me why the above is equivalent and the below two questions that came up.</p>
  <p>Can you please explain to me:</p>
  <ol>
  <li>Why parameter <code>name</code> is undefined?</li>
  <li>How come the <code>console.log('a')</code> is printed before the <code>console.log('c')</code>?</li>
  </ol>
  <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>var name = 'alex';
  console.log('start');
  
  function print(cb) {
    console.log('a');
    cb();
  }
  
  function renderName(name) {
    console.log('b');
    console.log(name);
  }
  
  print(function onPrint(name) {
    console.log('name: ', name);
    console.log('c');
    return renderName(name);
  });</code></pre>
  </div>
  </div>
  </p>