javaScript's - inheritance, super keyword, new keyword
JavaScript’s (OOJS) Today’s topic - Inheritance, Super keyword, New keyword. Inheritance - Inheritance basically means to create a child class which has access to a parent class or base class. The child class inherits all the methods from its parent class. To create a class inheritance we use the Extends keyword. Inheritance is basically great for code reusability. WHY? Because you can use the properties and methods of the parent class in the child class. Super keyword - So basically the super() keyword is only available to classes. The super() always refers to the parent class constructor. By calling the super() method in the constructor of the child class you call the parent class constructor and get access to parent properties and methods. If there is a constructor in the child class the super() method should be used before this() keyword otherwise it will cause a reference error. New keyword - The new keyword is basically used to create an i...