Created
March 30, 2013 09:10
-
-
Save takaheraw/5276031 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(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