function Person1(firstName, lastName) {//无法推断参数的含义 this.firstName = firstName; this.lastName = lastName; this.toString = function() { return this.firstName + " " + this.lastName; } } function Person2(attrs) {//可读性更好,可扩展性更好 this.firstName = attrs["firstName"] this.lastName = attrs["lastName"]; this.toString = function() { return this.firstName + " " + this.lastName; } } var p1 = new Person1("Frank", "Zammetti"); var p2 = new Person2({ "firstName" : "Frank", "lastName" : "Zammetti" }); alert(p1); alert(p2);