Search code examples
javascriptecmascript-5

Are listed in Where are specifications for 「constructor.prototype」


function Js() {};
var js = new Js();
js.constructor.prototype; //Js {}
Js.prototype = {};
js.constructor.prototype; Object {}

function Js() {};
var js = new Js();
js.constructor;//function Js() {}
Js.prototype = {};
js.constructor;//function Js() {}

The difference between constructor.prototype and constructor?

Have been described in where behavior specification of about constructor.prototype?


Solution

  • The constructor object only reference the function which made the object, while the prototype contain all the properties and methods that will be inherited form a object, including the constructor property itself.