/* Create an Employee and a Student class. Run greetAtGBC() against each of the classes. Your classes should have a constructor that takes a name */
function Employee(name){this.name=name;}
Employee.prototype.getEmployeeHomeTown = function(){
return "Vancouver, BC";};
var employee1 = new Employee("Andrea");
var employee2 = new Employee("Holly");
function Student(name){
this.name=name;
}
var student1 = new Student("Luke");
var student2 = new Student("Pat");
/*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?");
}
}*/
greetAtGBC(student1);
//alert(me.getEmployeeHomeTown());
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.