首页 > Web开发 > 详细

jQuery源码分析系列 学习记录

时间:2014-02-20 22:18:36      阅读:453      评论:0      收藏:0      [点我收藏+]

最近在跟nuysoft 的 jQuery源码分析系列 ,把不深入的知识点自己做些摘要取出来,记录下。

 1. 函数自调用括号有两种写法(仔细看括号的位置):

1
2
3
4
5
6
7
8
9
(function() {
    console.info( this );
    console.info( arguments );
}( window ) );         //(foo{}());
 
(function() {
    console.info( this );
    console.info( arguments );
}) ( window ));       //(foo{})();

2.  undefined可以被重写,必要时需要显式赋值.

在在参数列表中增加undefined呢?

在 自调用匿名函数 的作用域内,确保undefined是真的未定义。因为undefined能够被重写,赋予新的值。

1
2
undefined = "defined";
console.log(undefined);

  测试结果:    ie7/8/9: "defined";    

                         chrome 32,firefox26: "undefined"

3.

jQuery源码分析系列 学习记录

原文:http://www.cnblogs.com/liaopr/p/3557180.html

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