JSFiddle - React, Tailwind, and code Playground
by harperj1029
JavaScript
var print = function(message) {
document.write(message + '<br/>');
};
var my = {};
my.person = function() {};
my.person.prototype = {
saySomething: function() {
print('I am ' + this.firstName);
}
};
my.employee = function(firstName) {
this.firstName = firstName;
this.title = 'Employee';
};
my.employee.prototype = new my.person();
var employee1 = new my.employee('Jason');
employee1.saySomething();
my.manager = function(firstName) {
this.title = 'Manager';
this.firstName = firstName;
};
my.manager.prototype = new my.person();
var manager1 = new my.manager('Travis');
manager1.saySomething();