I am learning ES6 classes and object. In order to that I'm making a sample app, and I found this issue:
I have this MainClass:
class App {
boot() {
console.log('app booted')
}
}
Then I have another Class, that extends from the first one:
class someClass extends App {
boot() {
this.update()
}
update() {
console.log('update Method!')
}
}
From someClass
I'm overwriting the boot method. This works fine, since it's trying to call update
mothod.
But it's returning update
method as undefined
.
I get that, this
in this case is the App
class, so update
is undefined inside App
.
Is there a way to call the update
method from the boot
method in someClass
class?