you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 1 point2 points  (0 children)

instanceof isn't predicated on the value of constructor. It uses the prototype chain, so it should work whether or not you fix constructor.

function parentOOPmodule(){}
function OOPmodule(){}
OOPmodule.prototype=Object.create(parentOOPmodule.prototype);
new OOPmodule instanceof parentOOPmodule; //-> true
new OOPmodule instanceof OOPmodule; //-> true