title: JavaScript function declaration and evaluation order
body: <p>Why does the first one of these examples not work, but all the other ones do?</p>
  
  <pre><code>// 1 - does not work
  (function() {
  setTimeout(someFunction1, 10);
  var someFunction1 = function() { alert('here1'); };
  })();
  
  // 2
  (function() {
  setTimeout(someFunction2, 10);
  function someFunction2() { alert('here2'); }
  })();
  
  // 3
  (function() {
  setTimeout(function() { someFunction3(); }, 10);
  var someFunction3 = function() { alert('here3'); };
  })();
  
  // 4
  (function() {
  setTimeout(function() { someFunction4(); }, 10);
  function someFunction4() { alert('here4'); }
  })();
  </code></pre>