Is it possible to determine if
Parent.myMethod()
is being called "naturally" or through "override"
Not really (without resorting to the non-standard, deprecated caller
property). But you can detect when the method is called on an object that has a different myMethod
property:
this.myMethod === Parent.prototype.myMethod
and in that case return something else?
You really should not. Make it a parameter (but beware) that you expect something else, or divide the functionality in two different methods.