Re: [問題] 關於Javascript的prototype問題
說哪個最先有,可能會混淆焦點。看一下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
推
08/28 17:45, , 1F
08/28 17:45, 1F
推
08/30 02:31, , 2F
08/30 02:31, 2F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章