KEMBAR78
Extending built in objects | PDF
Extending Built-in Objects
IdeasInteractive.com.pk
Objects
Array
String
function(){}
Null
Undefined
Boolean
RegEx
Prototypes
Function A(){}
A
Function A(){}
A.prototype.x = 27;
A X : 27
Function A(){}
A.prototype.x = 27;
var B = new A;
A X : 27
B
Function A(){}
A.prototype.x = 27;
var B = new A;
B.name = “Ahmed Murtaza”;
A X : 27
B name : “Ahmed Murtaza”
Array.prototype.printMe = printme;
function printme(){
for(var i=0;i<this.length;i++)
console.log(this[i]);
}
Where our
printMe method
should live
printMe
Thank You
By
Ideas Interactive
@ideainteractive

Extending built in objects