function BaseClass(sColor) { this.color = sColor; this.sayColor = function () { alert(this.color); }; } function SubClass(sColor, sName) { BaseClass.apply(this, new Array(sColor)); this.name = sName; this.sayName = function () { alert(this.name); }; } var objA = new BaseClass("red"); var objB = new SubClass("blue", "MyName"); objA.sayColor(); objB.sayColor(); objB.sayName();