Skip to content

Instantly share code, notes, and snippets.

@MagicControl
Created May 2, 2017 07:23
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 MagicControl/6f5a20fbfb0078f7ceda43f1ebb165f0 to your computer and use it in GitHub Desktop.
Save MagicControl/6f5a20fbfb0078f7ceda43f1ebb165f0 to your computer and use it in GitHub Desktop.
var A = function() {
this.a = [];
}
A.prototype.hello = function() {
console.log('Hello from A!');
}
var B = function(a) {
if (a) {
this.a = a;
}
}
B.prototype = new A();
var b = new B();
var c = new B();
b.a.push('hello');
console.log(c.a); //['hello']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment