Last active
August 29, 2015 14:15
-
-
Save shadone/fc3c1ba62d370d636523 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 Base() { | |
} | |
Base.foo = 'foo'; | |
function Derived() { | |
Base.call(this); | |
} | |
Derived.prototype = Object.create(Base.prototype); | |
// Derived.prototype.constructor = Derived; // {1} | |
Derived.bar = 'bar'; | |
var d = new Derived(); | |
console.log('(1) keys(d)', Object.keys(d)); | |
console.log('(2) keys(d.constructor) =', Object.keys(d.constructor)); // why no 'bar' ??!!! | |
// if uncomment {1} then I get 'bar' but do not get 'foo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment