摘要: 同样源自邓师兄/*** 延迟指定时间后执行函数*/Function.prototype.delay = function(timeout){ timeout = timeout || 0; var This = this; //注意 arguments 不是数组 // arguments[0] 就是 timeout,后面的才是真正要传入的参数 var args = Array.prototype.slice.call(arguments, 1); return window.setTimeout(function() { ... 阅读全文
posted @ 2011-10-07 22:59 realwall 阅读(283) 评论(0) 推荐(0)
摘要: 首先说下null与undefined区别:对已声明但未初始化的和未声明的变量执行typeof,都返回"undefined"。null表示一个空对象指针,typeof操作会返回"object"。一般不显式的把变量的值设置为undefined,但null相反,对于将要保存对象的变量,应明确的让该变量保存null值。var bj;alert(bj); //"undefined"bj = null;alert(typeof bj); //"object"alert(bj == null); //truebj = {};al 阅读全文
posted @ 2011-10-07 19:53 realwall 阅读(26637) 评论(1) 推荐(2)