Created
January 6, 2019 13:04
-
-
Save weivall/a9096e4595dcc2dcd93c78a2b253ee3e to your computer and use it in GitHub Desktop.
js inheritance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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