Reputation: 3711
Let's say I have the following class:
class MyClass {
constructor () { /* etc */ }
myFunc () {
return myFuncToCall()
}
myFuncToCall () { /* etc */ }
}
What is the correct way to call myFuncToCall
from within myFunc
?
Upvotes: 1
Views: 120
Reputation: 3042
the class syntax is just a syntax suger for prototype inheritence. every instance method is on the prototype of MyClass.
class MyClass {
constructor() {
}
myFunc(){
return this.myFuncToCall()
}
myFuncToCall(){
}
}
Upvotes: 5