Skip to content

Instantly share code, notes, and snippets.

@weivall
Created January 6, 2019 13:04
Show Gist options
  • Select an option

  • Save weivall/a9096e4595dcc2dcd93c78a2b253ee3e to your computer and use it in GitHub Desktop.

Select an option

Save weivall/a9096e4595dcc2dcd93c78a2b253ee3e to your computer and use it in GitHub Desktop.
js inheritance
function Employee() {
this.name = '';
this.dept = 'general';
}
function Manager() {
Employee.call(this);
this.reports = [];
}
Manager.prototype = Object.create(Employee.prototype);
function WorkerBee() {
Employee.call(this);
this.projects = [];
}
WorkerBee.prototype = Object.create(Employee.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment