title: Are functions defined regardless of the order?
body: <p>I'm not really a javascript noob at all, although in my whole life I've never came across this, but am I right in assuming that javascript must assign functions before running anything or something?</p>
  
  <p>In all my experience, I expected this to return 'undefined', but obviously it returns 'function'.</p>
  
  <pre><code>function bar() {
      return foo;
      foo = 10;
      function foo() {}
      var foo = '11';
  }
  alert(typeof bar());
  </code></pre>
  
  <p>Is someone able to explain this for me?</p>