class A { constructor() { this.x = 1; }}class B extends A { constructor() { super(); this.x = 2; super.x = 3; console.log(super.x); // undefined console.log(this.x); // 3 }}let b = new B();对两次console出来的结果不理解。这段代码出自阮一峰的es6
添加回答
举报
0/150
提交
取消