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();