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
原型對象的constructor
喵喔喔
2018-08-10 09:06:59