title: Using javascript function before its definition
body: <p>In John Resig's 'Learning Advanced Javascript' slide #6 (<a href="http://ejohn.org/apps/learn/#6" rel="nofollow">http://ejohn.org/apps/learn/#6</a>) shows that you can use a function before it's defined. Here is the code:</p>
  
  <pre><code>var canFly = function(){ return true; }; 
  window.isDeadly = function(){ return true; }; 
  assert( isNimble() &amp;&amp; canFly() &amp;&amp; isDeadly(), "Still works, even though isNimble is moved." ); 
  function isNimble(){ return true; }
  </code></pre>
  
  <p>However, I noticed the following code does not pass the test.</p>
  
  <pre><code>assert( canFly(), "Still works, even though isNimble is moved." ); 
  var canFly = function(){ return true; }; 
  </code></pre>
  
  <p>It looks like assigning an anonymous function to a variable is different from defining a named function. Why is that? And what is the name of this concept that describe the ability to use function before its definition in a language?</p>