我们将使用构造函数模式将工厂模式进行改写。 代码如下: function Employee(name, age, job) { this.name = name; this.age = age; this.job = job; this.sayName = function () { alert(this.name); }; } var Jim = new Employee(“jim”, 22, “SoftWare Engineer”); var Sun = new Employee(“Sun”, 24, “Doctor”); Jim.sayName(); Sun.sayName(); 在