If I create the following classes, is there any way in Class1 to detect when the instance is actually one of Class2, without knowing anything about Class2?
i.e. Can Class1 tell when it's the parent class being extended?
class Class1 {
constructor() {
// Code to detect whether parent here
}
}
class Class2 extends Class1 {
constructor() {
super();
}
}