Employee Experience Details - Class and Object & Date
Write a JavaScript program to display the emplyoee experience details.
The method displayEmployee must take an employee's name, designation & year of experience as its arguments and invoke the createEmployee method with these arguments.
The createEmployee method should create an Employee Object out of the Employee class (object with values using a its parameterized constructor) and return the object to the caller - displayEmployee method.
Validate this object using instanceof operator and if valid, calculate the no of years in service (current year - year of joining) & return the same appended to a string (refer to console output). Note: You may fetch the current year using the Date function & you may verify the correctness of your function by invoking it from within console.log.
console.log(displayEmployee("Jerold","Manager",15));
Console Output :