Created
March 3, 2020 07:51
-
-
Save zonzujiro/c179fdb0c13691255ed2e62f197c305f to your computer and use it in GitHub Desktop.
This file contains 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 Parent() { | |
this.name = 'Parent' | |
} | |
Parent.prototype.getName = function() { | |
return `Mr. ${this.name}` | |
} | |
function Child() { | |
Parent.apply(this); | |
this.name = 'Child' | |
} | |
Child.prototype = Parent.prototype; | |
Child.prototype.getName = function() { // what will happen? | |
return this.name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment