Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   Programming General (http://siteownersforums.com/forumdisplay.php?f=44)
-   -   Javascript super keyword (http://siteownersforums.com/showthread.php?t=983346)

sahithya 04-11-2023 03:20 AM

Javascript super keyword
 
In JavaScript, the super keyword is used to call methods or access properties of a parent class within a subclass.

When a class extends another class, the subclass can call the constructor and methods of the parent class by using the super keyword.

For example, to call the constructor of the parent class, we can use super() inside the constructor of the subclass. This is useful when we want to inherit properties and behavior from the parent class.

The Car class calls the super keyword in its constructor to call the constructor of the parent Vehicle class and set the make and model properties. It then adds its own year property.

horizontour 04-26-2023 03:58 AM

Useful information about this forum thread posting and sharing online here.


All times are GMT -7. The time now is 06:17 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.