3. JavaScript Object Model overview
Constructor Object Prototype
Constructor
[[Prototype]]
Function Prototype
[[Prototype]] Constructor
[[Prototype]] Object.prototype
Constructor Function.prototype [[Prototype]]
[[Prototype]]
Constructor [[Prototype]] [[Prototype]] Number / String / ...
Prototype
Constructor
Constructor Number.prototype /
String.prototype / ... [[Prototype]]
function fx(){ } Prototype
[[Prototype]] [[Prototype]]
Constructor fx.prototype
[[Prototype]]
var x = new fx() var a = new Number(123) / var o = new Object() /
var y = 123 / var s = 'sss' Var oo = { }
2012/4/19 3
24. JavaScript Object Model overview
Constructor Object Prototype
Constructor
[[Prototype]]
Function Prototype
[[Prototype]] Constructor
[[Prototype]] Object.prototype
Constructor Function.prototype [[Prototype]]
[[Prototype]]
Constructor [[Prototype]] [[Prototype]] Number / String / ...
Prototype
Constructor
Constructor Number.prototype /
String.prototype / ... [[Prototype]]
function fx(){ } Prototype
[[Prototype]] [[Prototype]]
Constructor fx.prototype
[[Prototype]]
var x = new fx() var a = new Number(123) / var o = new Object() /
var y = 123 / var s = 'sss' Var oo = { }
2012/4/19 24