首页 > 其他 > 详细

Function Expression

时间:2015-05-12 22:52:12      阅读:192      评论:0      收藏:0      [点我收藏+]

  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.

Function Expression

原文:http://www.cnblogs.com/linxd/p/4498763.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!