Inheritance
JavaScript
const a = function(x) {
this.x = x;
this.getX = function() {
return this.x;
}
}
const b = function(x, y) {
this.y = y;
a.call(this, x);
this.getY = function() {
return this.y
}
}
const newB = new b('x', 'y');
console.log(newB.getX());
console.log(newB.getY());