Consider the Constructor functions:
function ConstructorOne(){/*.....*/}
function ConstructorTwo(){/*.....*/}
Consider the following js code:
var myInstance = new ConstructorOne();
ConstructorOne.prototype=new ConstructorTwo();
myInstance instanceof ConstructorOne; // false - why?
myInstance instanceof ConstructorTwo; // false - why?
If I instantiate after assigning a prototype to the constructor, like this, all goes ok:
ConstructorOne.prototype = new ConstructorTwo();
var myInstance = new ConstructorOne();
myInstance instanceof ConstructorOne; // true
myInstance instanceof ConstructorTwo; // true
What is the reason for this anomalous behaviour in the first example?
Here's the fiddle.