Classes :
- Classes are similar to functions, but it is not hoisted.
- Class syntax does not introduce an object model to JavaScript, but it is only syntactic sugar for existing prototype-based inheritance.
- The class body contains only methods, not properties. There are three types of methods
1**) Constructor method:**
- It is used for creating and initialising objects.
- A class contains only a single constructor method.
- Prototype method:
display(){ }
- Static method: class-level method. You can access the class.
static display(){ }
ClassName.display()
Inheritance :
In a child class, there is no constructor method at that time; it will invoke the parent class constructor, even if it is either a default or parameterised constructor.
In the child class and parent class, there are constructors that time it will raise an error; to overcome this problem, through the "super" keyword.