// 修改toString()的返回值。
function Person(name, age, gender) {
this.name = name;
this.age = age;
this.gender = gender;
this.show = function() {
console.log("你的姓名是:" + name + ";你的年龄是:" + age);
}
}
Person.prototype.story = "西游记";
Person.prototype.sayHello = function() {
console.log("我喜欢看" + this.story);
};
Person.prototype.toString = function() {
return "Person[name=" + this.name + ";age=" + this.age + ";gender=" + this.gender + "]";
};
var person = new Person('孙悟空', 1000, '男');
console.log(person.hasOwnProperty("西游记"))
console.log(person.toString());