JSFiddle - React, Tailwind, and code Playground
by Chandra Shekhar
JavaScript
var Employee = {
eyeColor : "Blue",
setEmployeeDetails : function(ObjEngineer) {
this.firstName = ObjEngineer.firstName;
this.lastName = ObjEngineer.lastName;
this.age = ObjEngineer.age;
this.tech = ObjEngineer.technology;
}
};
//Add new method to existing class
Employee.display = function ()
{
alert("firstName="+this.firstName+"lastName"+this.lastName+"age="+this.age+"technology"+this.tech);
}
var Engineer = function(tech,firstName,lastName,age){
this.technology = tech;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
Employee.setEmployeeDetails(this);//Inherited function
Employee.display();//Inherited function
}
var ObjEngineer = new Engineer("PHP","CS","Pandey",30);