摘引至"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.
...
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 ...
js中基于prototype实现继承的基本代码如下所示:
function(SubClass, SuperClass){
function F(){}
//
F.prototype = SuperClass.prototype;
// 实现继承的关键,构造 prototype chain
SubClass.prototype = new F(); // 1
// 重置子类prototype对象的constructor属性为子类本身。
SubClass.prototype.constructor = SubClass;
...
一 js的扫描过程
js在执行代码之前,会有一个扫描(相当于预编译)的过程,这一过程用于获取定义的变量名和函数对象。主要包括如下几个处理步骤:
碰到了“var instance=xxx;” 这样的语句时,则在当前variable object上添加此属性,赋初值为undefined
碰到了函数的定义"function func(){}"时,则使用此函数定义创建相应的函数对象,然后在varable object对象上添加此属性func,其值为返回的函数对象。
&nbs ...
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 ...
- 浏览: 3139 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
最新评论
-
对java中equals和hashCode ...
谢谢博主的详细解释. 不过有一个问题: 引用在Object类equals函数 ...
-- by rmn190 -
对java中equals和hashCode ...
明白了,谢谢
-- by NicholasBugs






评论排行榜