JSFiddle - React, Tailwind, and code Playground
by Tim Morgan
JavaScript
function greetAtGBC(person) {
console.log("Hello " + person.name + "!");
if (person instanceof Employee) {
console.log("Your mailroom is at A4-123");
} else if (person instanceof Student) {
console.log("How are your studies progressing?");
}
}
function Employee(name) { this.name = name;}
Employee.prototype.getOfficeAddress = function() {
return "The office building.";
}
Employee.prototype.costOfLivingRaise() {this.salary = this.salary * 1.02;}
Employee.prototype.hire = function() {this.status = "Active";}
Employee.prototype.fire = function() {this.status = "Inactive";}
function Student(name) { this.name = name; }
var me = new Employee("Oggami Itto");
var student = new Student("Restuido");
//greetAtGBC(me);
//greetAtGBC(student);
alert(me.getOfficeAddress());