Inheritance in JavaScript
Medium
10
39.4% Acceptance
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.