3 ms·
A couple of lines up you see this: Bar.prototype = new Foo(); Then, Bar.prototype.constructor == Foo() So when you create a new instance of Bar, it's const
by nfriedly 16y ago
A couple of lines up you see this:
Bar.prototype = new Foo();
Then, Bar.prototype.constructor == Foo()
So when you create a new instance of Bar, it's constructor still appears to be Foo even though it really isn't. Setting the prototype.constructor fixes that.