Skip to content

Instantly share code, notes, and snippets.

@zonzujiro
Created March 3, 2020 07:51
Show Gist options
  • Save zonzujiro/c179fdb0c13691255ed2e62f197c305f to your computer and use it in GitHub Desktop.
Save zonzujiro/c179fdb0c13691255ed2e62f197c305f to your computer and use it in GitHub Desktop.
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