title: Why JavaScript function declaration (and expression)?
body: <p>I've seen others using the following pattern. </p>
  
  <pre><code>var bar = function foo(){};
  console.log(bar); // foo()
  console.log(foo); // ReferenceError: foo is not defined
  </code></pre>
  
  <p>But why? I can see the point if both were declared, but they're not. Why is the reason?</p>