作者fillano (冒牌费大公)
看板Ajax
标题Re: [问题] 关於Javascript的prototype问题
时间Thu Aug 28 16:41:53 2008
说哪个最先有,可能会混淆焦点。看一下ECMA-262 Edition3文件:
关於Object,他说明:
15.2.4 Properties of the Object Prototype Object
The value of the internal [[Prototype]] property of the Object prototype
object is null and the value of the internal [[Class]] property is "Object".
关於Function,他说明:
15.3.4 Properties of the Function Prototype Object
The Function prototype object is itself a Function object (its [[Class]] is
"Function") that, when invoked, accepts any arguments and returns undefined.
The value of the internal [[Prototype]] property of the Function prototype
object is the Object prototype object (section 15.3.2.1).
从他的规定,基本上可以看作Function继承Object。
Javascript内部实作,可能不会管谁继承谁,只是依照ECMA-262 Edition3的标准,把
该给什麽值的地方给什麽值而已。所以不要烦恼Native ECMAScript Objects这方面的
问题啦。
--
Sapere Aude! 这就是启蒙运动的口号!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.250.95.16
1F:推 gpmm:喔喔喔喔又现身了!娘子快来看高手!!(拜倒) 08/28 17:45
2F:推 blackbing:哇赛~fillano高手~(拜倒) 08/30 02:31