Function Expression

  One of the key characteristics of function declarations is function declaration hoisting, whereby function declarations are read before the code excutes. That means a function declaration may appear after code that calls it and still work:

1 sayHi();
2 function sayHi(){
3     alert("Hi!");
4 }

  Function expressions act like other expressions and, therefore, must be assigned before usage. The following causes an error:

1 sayHi();              // error - function doesn't exist yet
2 var sayHi = function(){
3     alert("Hi!");
4 };

  It's advisable to always use arguments.callee of the function name whenever you're writing recursive functions.

原文地址:https://www.cnblogs.com/linxd/p/4498763.html