mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
docs(class-extends): fix #854
This commit is contained in:
parent
62b5147d21
commit
7518f7b12d
@ -447,7 +447,7 @@ B.__proto__ = A;
|
||||
这两条继承链,可以这样理解:作为一个对象,子类(`B`)的原型(`__proto__`属性)是父类(`A`);作为一个构造函数,子类(`B`)的原型对象(`prototype`属性)是父类的原型对象(`prototype`属性)的实例。
|
||||
|
||||
```javascript
|
||||
Object.create(A.prototype);
|
||||
B.prototype = Object.create(A.prototype);
|
||||
// 等同于
|
||||
B.prototype.__proto__ = A.prototype;
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user