Skip to content

Instantly share code, notes, and snippets.

@yankov
Created October 12, 2012 22:10
Show Gist options
  • Save yankov/3881879 to your computer and use it in GitHub Desktop.
Save yankov/3881879 to your computer and use it in GitHub Desktop.
function A(name) {
this.name = name;
}
A.prototype.b = function(lastName) {
this.lastName = lastName;
console.log(this.name + " " + this.lastName);
}
a1 = new A("Howard");
a2 = new A("Vance");
b1 = new a1.b("H"); // access to a parent object lost. this.name == undefined
b2 = new a2.b("I");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment