Project 1

This commit is contained in:
Karan
2021-11-24 21:05:00 +05:30
committed by GitHub
parent 8a5e6d002c
commit bf9e8d124a
+17
View File
@@ -0,0 +1,17 @@
class Employee {
constructor(first, last, years) {
this.first = first;
this.last = last;
this.years = years;
}
}
const person1 = new Employee("Laurence", "Svekis", 10);
const person2 = new Employee("Jane", "Doe", 5);
const workers = [person1, person2];
Employee.prototype.details = function(){
return this.first + " " + this.last + " has worked here " + this.years + " years"
}
workers.forEach((person) => {
console.log(person.details());