function Dog(name){
this.name=name;
}
let dogA=new Dog('Paul');
Dog.prototype.eat=true;
dogA.eat; //true,獲得建構式的eat屬性
Dog.prototype=null; //將建構式的原型改為null
dogA.eat; //true 。。。怎么實體物件還有eat?
照道理不是建構式的prototype已經不存在了嗎,完全變成了null,怎么dogA這個實體物件還能獲得eat=true?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/272409.html
標籤:JavaScript
