Passing in of default values for the various properties in Object creation function
|
|
function createObject(sColor, iDoors) { var bufObject = new Object; bufObject.color = sColor; bufObject.doors = iDoors; bufObject.showColor = function () { alert(this.color) };
return bufObject; }
var myHourse1 = createObject("red", 4); var myHourse1 = createObject("blue", 3); myHourse1.showColor(); myHourse2.showColor();
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
|