I have two functions with same names. One inside child class and one inside parent.
I thought If i call method in parent class that parent's function will be invoked.
But it looks it doesn't work like this and invokes child function.
So my question is how to invoke parent function in parent class if i have another with same name in child class.
I would like to get 'Parent' and 'Child', but i get 2 times 'Child'
class Parent {
constructor() {
this.init()
}
init() {
console.log('Parent');
}
}
class Child extends Parent {
constructor() {
super();
this.init()
}
init() {
console.log('Child');
}
}
new Child();