JSFiddle - React, Tailwind, and code Playground
JavaScript
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person.prototype.getFullName = function() {
return this.firstName + " " + this.lastName;
};
function Employee(firstName, lastName, position) {
Person.call(this, firstName, lastName);
this.position = position;
}
Employee.prototype = Object.create(Person.prototype);
Employee.prototype.getEmployeeInfo = function() {
return this.getFullName() + ", " + this.position;
};
var employee = new Employee("John", "Doe", "Manager");
var info = employee.getEmployeeInfo();
alert(info);