Skip to content

Latest commit

 

History

History

50

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Inheritance in JavaScript

In this lab, you are going to apply the concept of inheritance by creating classes and their relationship in JavaScript. First, you will create a Person class with properties 'firstName' and 'lastName'. Then, create a method 'fullName()' that returns the full name of the person.

After that, create another class Employee that inherits from the Person class. Add new properties 'position' and 'salary' to this derived class. Finally, create a 'toString()' method that returns the string representation of the Employee object.