Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Created August 23, 2019 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyckahn/768505ac1c4a0982221fb0df5c965136 to your computer and use it in GitHub Desktop.
Save jeremyckahn/768505ac1c4a0982221fb0df5c965136 to your computer and use it in GitHub Desktop.
Refresher on prototypal inheritance
function Parent () { console.log('parent') }
Parent.prototype.parentMethod = function () { console.log('this is a method on the parent object') }
function Child () { console.log('child') }
Child.prototype = new Parent()
var child = new Child()
child.parentMethod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment