Javascript, extending ES6 class setter will inheriting getter
问题 In Javascript, with the following illustration code: class Base { constructor() { this._val = 1 } get val() { return this._val } } class Xtnd extends Base { set val(v) { this._val = v } } let x = new Xtnd(); x.val = 5; console.log(x.val); // prints 'undefined' the instance x will not inherit get val()... from Base class. As it is, Javascript treat the absence of a getter, in the presence of the setter, as undefined. I have a situation in which I have many classes that all have the exact same