ES6 allows us to inherit static methods of a parent class.

Consider the following example where a static method of Bus is called on its derived class (SchoolBus):


class Bus { 
  static radio() { //from  w  w  w .j ava  2  s.c o  m
       console.log("Radio works"); 

class SchoolBus extends Bus {};


Here, a new static radio() method is added to the Bus class.

Using inheritance, this method is available as and behaves in the same manner as the method.

Related Topic