2008-08-26

javascript中==和===操作符的比较

关键字: javascript 操作符
摘引至"JavaScript: The Definitive Guide, 5th Edition " chapter 5 section 4   In JavaScript, numbers, strings, and boolean values are compared by value . In this case, two separate values are involved, and the == and === operators check that these two values are identical. ...
2008-08-26

mootools Class 继承机制

关键字: mootools class extend
var Class=function(B) { var A=function() { // 存在initialize函数的话就执行此函数,否则直接返回 // arguments[0] 在什么情况下会 === null ? return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=="function")?this.initialize.apply(this,arguments):this; }; $extend ...
2008-08-26

javascript prototype 继承

关键字: javascript prototype extend
js中基于prototype实现继承的基本代码如下所示: function(SubClass, SuperClass){ function F(){} // F.prototype = SuperClass.prototype; // 实现继承的关键,构造 prototype chain SubClass.prototype = new F(); // 1 // 重置子类prototype对象的constructor属性为子类本身。 SubClass.prototype.constructor = SubClass; ...
2008-08-21

javascript 执行模型的一些测试

关键字: javascript 执行模型
一 js的扫描过程     js在执行代码之前,会有一个扫描(相当于预编译)的过程,这一过程用于获取定义的变量名和函数对象。主要包括如下几个处理步骤: 碰到了“var instance=xxx;” 这样的语句时,则在当前variable object上添加此属性,赋初值为undefined 碰到了函数的定义"function func(){}"时,则使用此函数定义创建相应的函数对象,然后在varable object对象上添加此属性func,其值为返回的函数对象。   &nbs ...
2008-05-26

javascript object model

关键字: javascript object function
the difference between prototype property and [[prototype]] which constructs the chain of prorotype each object has a inner property called '[[prototype]] ', whose value is null or point to some object. This property is visible only for JS engine.(in firefox, this property can visited ...