i.e.
class A {
do_something(){ throw Exception("Not implemented") }
}
class B extends A{
...
}
When checking typeof B.do_something === 'function' it gives true because of inheritance. So, how can we check whether B has itself defined do_something method(function)?
I don't think there is an built-in "class API" way to do this. But it's simple enough when remembering that classes are just syntactic sugar for JS's prototype system.
Here we have:
B.prototype.hasOwnProperty("do_something") // false
A.prototype.hasOwnProperty("do_something") // true
And in practice if you have an object which is an instance of the class, you can substitute that for B.prototype or A.prototype in the above expressions.