1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

补充完善表述

This commit is contained in:
xianshenglu 2018-04-01 21:23:14 +08:00 committed by GitHub
parent 4123978a0a
commit 7fc640d46b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ let b = new B();
上面代码中,属性`x`是定义在`A.prototype`上面的,所以`super.x`可以取到它的值。
ES6 规定,通过`super`调用父类的方法时,方法内部的`this`指向当前的子类实例
ES6 规定,在子类普通方法中通过`super`调用父类的方法(此时调用的是父类普通方法,因为`super`指向父类的原型对象)时,方法内部的`this`指向当前的子类实例;在子类静态方法中通过`super`调用父类的方法(此时调用的是父类静态方法,因为`super`指向父类)时,方法内部的`this`指向当前的子类;
```javascript
class A {