I noticed this interesting problem:
function a() { this.aprop = 1; }
function b() { this.bprop = 2; }
b.prototype = new a();
var x = new b();
assert(x.constructor == b);
assert(x.constructor == a);
As far as I know, it x.constructorshould be b, but in fact a, when does it binherit from athrough its prototype? Is there a way I can inherit from awithout stuffing my constructor in?
source
share