Mike Alsup schrieb:

The difference between a function declaration and a function
expression is when the actual "function object" gets created.  The
easiest way to think of it is that function declarations are always
available and function expressions are not available until they have
been evaluated.  So you can do this:

x();
function x() { alert('hi'); }

but not this:

x();
var x = function() { alert('hi'); }

For details check out: http://jibbering.com/faq/faq_notes/closures.html

Mike

Dustin blogged about this recently as well:

http://www.dustindiaz.com/javascript-function-declaration-ambiguity/



-- Klaus

Reply via email to