If you want something you've never had, you must be willing to do something you've never done!

Powered by Blogger.

JavaScript Objects (prototype) 0

Cerita Semalam Aaz | 8:52 AM | ,


Prototype




// Constructor of the MyObject function MyObject(name, size){
this.name=name;
this.size=size;
}
// Add a function to the prototype
MyObject.prototype.tellSize=function{
alert(“size of “ + this.name+” is + this.size);
}


// Create an instance of the object. The new object has tellSize() method. var myObj=new MyObject(“Sang, 30 inches”);
myObj.tellSize();


SEE VIDEO

0 Responses So Far:

Related Post

 
Back To Top