⊗jsOpAdCMI 47 of 60 menu

Classes, Modules, and Inheritance in OOP in JavaScript

Let's look at how to inherit classes placed in modules. Let's say we have the following class:

export default class User { }

Let us inherit another class from this class:

export default class Student extends User { }

In this case, the parent class must be connected to the child class:

import User from './User.js'; export default class Student extends User { }

Place the Programmer class in a separate file.

Make the Programmer class inherit from the Employee class.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline