JS创建对象之构造函数模式

function Person(name, age, job) {
    this.name = name;
    this.age = age;
    this.job = job;
    this.sayName = function() {
        alert(this.name);
    };
}

var person1 = new Person("Mary", 29, "Software Engineer");
var person2 = new Person("Mike", 29, "Software Engineer");

原文地址:https://www.cnblogs.com/soldierback/p/10697802.html