最近在跟nuysoft 的 jQuery源码分析系列 ,把不深刻的知识点本身作些摘要取出来,记录下。javascript
1. 函数自调用括号有两种写法(仔细看括号的位置):html
(function() { console.info( this ); console.info( arguments ); }( window ) ); //(foo{}()); (function() { console.info( this ); console.info( arguments ); }) ( window )); //(foo{})();
2. undefined能够被重写,必要时须要显式赋值.java
在在参数列表中增长undefined呢?chrome
在 自调用匿名函数 的做用域内,确保undefined是真的未定义。由于undefined可以被重写,赋予新的值。函数
undefined = "defined"; console.log(undefined);测试结果: ie7/8/9: "defined"; 源码分析
chrome 32,firefox26: "undefined"测试
3.this