1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-27 20:32:21 +00:00

Merge pull request #284 from ifishing/gh-pages

修正一个“类的实例对象”节 的错误:“它们的原型都是Point”
This commit is contained in:
Ruan YiFeng 2016-11-24 16:05:13 +08:00 committed by GitHub
commit 693fb27fed

View File

@ -266,7 +266,7 @@ p1.__proto__ === p2.__proto__
//true
```
上面代码中,`p1``p2`都是Point的实例它们的原型都是Point所以`__proto__`属性是相等的。
上面代码中,`p1``p2`都是Point的实例它们的原型都是Point.prototype,所以`__proto__`属性是相等的。
这也意味着,可以通过实例的`__proto__`属性为Class添加方法。