This is about "inheritance" in JavaScript.
Suppose I create a constructor Bird(), and another called Parrot() which I make to "inherit" the properties of Bird by assigning an instance of it to Parrot's prototype, like the following code shows:
function Bird() {
this.fly = function(){};
}
function Parrot() {
this.talk = function(){ alert("praa!!"); };
}
Parrot.prototype = new Bird();
var p = new Parrot();
p.talk(); // Alerts "praa!!"
alert(p.constructor); // Alerts the Bird function!?!?!
After I've created an instance of Parrot, why is the .constructor property of it Bird(), and not Parrot(), which is the constructor I've used to create the object?