diff --git a/docs/JavaScript/inherit.md b/docs/JavaScript/inherit.md index 353c1848..8f5b2d8d 100644 --- a/docs/JavaScript/inherit.md +++ b/docs/JavaScript/inherit.md @@ -263,7 +263,7 @@ Child6.prototype.getFriends = function () { } let person6 = new Child6(); -console.log(person6); //{friends:"child5",name:"child5",play:[1,2,3],__proto__:Parent6} +console.log(person6); //{friends:"child5",name:"parent6",play:[1,2,3],__proto__:Parent6} console.log(person6.getName()); // parent6 console.log(person6.getFriends()); // child5 ``` @@ -310,4 +310,4 @@ asuna.getName() // 成功访问到父类的方法 通过`Object.create` 来划分不同的继承方式,最后的寄生式组合继承方式是通过组合继承改造之后的最优继承方式,而 `extends` 的语法糖和寄生组合继承的方式基本类似 ## 相关链接 -https://zh.wikipedia.org/wiki/%E7%BB%A7%E6%89%BF \ No newline at end of file +https://zh.wikipedia.org/wiki/%E7%BB%A7%E6%89%BF