OOP
by soum1
JavaScript
class softwaredeveloper {
constructor(name, lang, proj) {
this.Name = name;
this.Language = lang;
this.Project = proj;
}
DisplayDetails() {
document.write("<li>");
document.write("<strong>Name:</strong> " + this.Name + "<br/>");
document.write("<strong>Programming Language:</strong> " + this.Language + "<br/>");
document.write("<strong>Current Project:</strong> " + this.Project + "<br/>");
document.write("</li>");
}
DisplayNames() {
document.write("<li>");
document.write("<strong>Name:</strong> " + this.Name + "<br/>");
document.write("</li>");
}
}
let dev1 = new softwaredeveloper("Soumya","c#","Porject1");
let dev2 = new softwaredeveloper("Soum1","Java","Porject2");
let dev3 = new softwaredeveloper("Soum2","Python","Porject3");
document.write("<ul>");
dev1.DisplayDetails();
dev2.DisplayDetails();
dev3.DisplayDetails();
document.write("</ul>");
document.write("<ul>");
dev1.DisplayNames();
dev2.DisplayNames();
dev3.DisplayNames();
document.write("</ul>");