Skip to content

Instantly share code, notes, and snippets.

@jdivock
Created December 7, 2014 12:35
Show Gist options
  • Save jdivock/47f4632f75a7e3f5807d to your computer and use it in GitHub Desktop.
Save jdivock/47f4632f75a7e3f5807d to your computer and use it in GitHub Desktop.
inheritance example
// Code goes here
var Parent = function(foo1){
this.foo1 = foo1
}
Parent.prototype.derp = function(){
console.log('derp derp');
}
var par1 = new Parent('hi');
console.log(par1);
var Child = function(foo1){
Parent.call(this, foo1)
};
Child.prototype = new Parent();
var child1 = new Child('derpina');
console.log('child', child1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment