Skip to content

Latest commit

 

History

History
5 lines (3 loc) · 568 Bytes

readme.md

File metadata and controls

5 lines (3 loc) · 568 Bytes

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.