如下代码,为什么xiaoming这个对象无法调用say这个方法?怎么写在里面就报错?function Person(name) { this.name = name; this.prototype.say = function () {
alert("大家好我是"+this.name);
};
}
var xiaoming = new Person("robot"); console.log(xiaoming.name);
xiaoming.say();
添加回答
举报
0/150
提交
取消