In John Resig's 'Learning Advanced Javascript' slide #6 (http://ejohn.org/apps/learn/#6) shows that you can use a function before it's defined. Here is the code:
var canFly = function(){ return true; };
window.isDeadly = function(){ return true; };
assert( isNimble() && canFly() && isDeadly(), "Still works, even though isNimble is moved." );
function isNimble(){ return true; }
However, I noticed the following code does not pass the test.
assert( canFly(), "Still works, even though isNimble is moved." );
var canFly = function(){ return true; };
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?