samedi 31 janvier 2015

Difference between constructor property?


Using parentheses:



function Constr(){};
console.log(Constr.prototype.constructor);//logs Constr()
Constr.prototype.constructor === Constr();//returns false


Without using parentheses:



function Constr(){};
Constr.prototype.constructor === Constr;//returns true


Why is this so?





Aucun commentaire:

Enregistrer un commentaire