function Super(){ this.name = "this is super";}Super.prototype = { say:function(){ console.log(this.name); }}function Sub(){ this.name = "this is sub";}Sub.prototype = new Super();var o = new Sub();o.say(); //this is sub实例 o 的原型对象的constructor是Super,那么 this.name 应该是Super的构造函数。但是输出是 this is sub
添加回答
举报
0/150
提交
取消