Class inheritance is a JavaScript feature that allows you to create new classes that are based on existing classes. This can be used to reuse code and to create more complex and powerful classes.
Static methods are methods that are associated with a class, not with an instance of a class. Static methods can be called without creating an instance of the class.
Private methods are methods that are only accessible from within the class that defines them. Private methods cannot be called from outside the class.
The following code defines a class called Person with a static method called getNumberOfPeople():
class Person {
static getNumberOfPeople() {
return 0;
}
}
The getNumberOfPeople() method is a static method. It can be called without creating an instance of the Person class.
The following code defines a class called Employee that inherits from the Person class:
class Employee extends Person {
constructor(name, age) {
super(name, age);