Function share with Prototype Paradigm
|
|
function Car() { }
Car.prototype.color = "red"; Car.prototype.doors = 4; Car.prototype.drivers = new Array("M", "S"); Car.prototype.showColor = function () { alert(this.color); };
var myHourse1 = new Car(); var myHourse2 = new Car();
myHourse1.drivers.push("M");
alert(myHourse1.drivers); alert(myHourse2.drivers);
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
|