behaviour of super
JavaScript
class ParentClass {
constructor() {
this.buildme();
}
buildme(){
this._doSomething();
}
_doSomething() {
this.foo = 'bar';
console.log(this.foo);
}
}
class ChildClass extends ParentClass{
constructor() {
super();
}
_doSomething() {
this.foo = 'poo';
console.log(this.foo);
}
}
const myChild = new ChildClass();