Can a class that is a child of another class be inherited from?

Question

Can a class that is a child of another class be inherited from? In other words, if a class B extends from a class A, can we extend a new class from class B?

Answer

Yes, you can absolutely extend from classes that themselves have extended from another class. There is no strict limit to the levels of inheritance possible.

For example, given the following class A, and class B which inherits from it,

class A {
  methodA() {
    console.log("From class A");
  }
}

class B extends A {
  methodB() {
    console.log("From class B");
  }
}

we can extend a class from B, say class C, which will inherit the methods and attributes of B, which inherited from A.

class C extends B {
  methodC() {
    console.log("From class C");
  }
}

const c = new C();
c.methodA(); // From class A
c.methodB(); // From class B
c.methodC(); // From class C