Prototype Inheritance
Prototype Inheritance
Object.prototype
Object Properties
Object.prototype is prototype Object of Object B
B
Object Properties
B will inherit All properties of Object.prototype
B1
Object B1 will inherit All properties of Object.prototype
Properties
B2
Object B2 will inherit All properties of Array.prototype
Properties
Object Object.prototype
b2
prototype is the property of function which points to the prototype object. Prototype Object
Prototype object can be accessed using Function_Name.prototype
__proto__ __proto__
}
prototype
I am looking for a
function Mobile( ) { Function Prototype
this.a = 10
}
prototype
// 10
I am looking for a
function Mobile( ) { Function Prototype
}
prototype
Mobile.prototype.a = 10
I am looking for a
Mobile.prototype.a === lg.__proto__.a
function Mobile( ) { Function Prototype
this.a = 10
} prototype
Mobile.prototype.a = 10
var lg = new Mobile()
Object
lg.a
__proto__
// 10
I am looking for a
Object.prototype
__proto__ null
Mobile.prototype.z = 30
var m = new Mobile() m Object
__proto__
s Object
var s = new Samsung()
__proto__
Object.prototype
__proto__ null
Mobile.prototype.z = 30
var m = new Mobile() m Object
__proto__
s Object
var s = new Samsung()
__proto__
Object.prototype
__proto__ null
Mobile.prototype.z = 30
var m = new Mobile() m Object
__proto__