Skip to content

Instantly share code, notes, and snippets.

@takaheraw
Created March 30, 2013 09:10
Show Gist options
  • Save takaheraw/5276031 to your computer and use it in GitHub Desktop.
Save takaheraw/5276031 to your computer and use it in GitHub Desktop.
function Parent(name){
this.name = name || 'Adam';
}
Parent.prototype.say = function(){
return this.name;
}
function Child(name){
Parent.apply(this, arguments);
}
Child.prototype = new Parent();
var kid = new Child("Patrick");
console.log(kid.name);
console.log(kid.say());
delete kid.name;
console.log(kid.say());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment