Skip to content

Instantly share code, notes, and snippets.

@jasonblanchard
Created July 31, 2014 22:42
Show Gist options
  • Select an option

  • Save jasonblanchard/6d328097515d2a4adf63 to your computer and use it in GitHub Desktop.

Select an option

Save jasonblanchard/6d328097515d2a4adf63 to your computer and use it in GitHub Desktop.
var Person = function(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person.prototype.fullName = function() {
return this.firstName + " " + this.lastName;
}
var Worker = function(firstName, lastName, title) {
Person.call(this, firstName, lastName);
this.title = title;
}
Worker.prototype = Object.create(Person.prototype);
Worker.prototype.constructor = Worker;
Worker.prototype.professionalName = function() {
return this.fullName() + ', ' + this.title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment