function Person(name, sex) { this.name = name; this.sex = sex; } Person.prototype = { getName: function () { return this.name; }, getSex: function () { return this.sex; } } Person.prototype.age = 25; var zhang = new Person("ZhangSan", "man"); var chun = new Person("ChunHua", "woman"); function Employee(name, sex, employeeID) { this.name = name; this.sex = sex; this.employeeID = employeeID; } function ShowCase() { alert(zhang.getName()); alert(chun.getName()); alert(zhang.age); alert(chun.age); Employee.prototype = new Person('vf','sf'); Employee.prototype.getEmployeeID = function () { return this.employeeID; }; var wa = new Employee("wawu", "man", "1234"); alert(wa.getName()); alert(wa.getEmployeeID()); }