!
Hola, amigos. I have this little class inheritance structure
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
toString() {
return '(' + this.x + ', ' + this.y + ')';
}
}
class ColorPoint extends Point {
constructor(x, y, color) {
super(x, y);
this.color = color;
}
toString() {
return super.toString() + ' in ' + this.color;
}
}
let newObj = new ColorPoint(25, 8, 'green');
It compiles to this jsfiddle
I get how it works in es6 in a silly way.
But could somebody explain how does it work under the hood in es5.
In a simpler form.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…