javascript - What is a constructor function's prototype? -


say, have constructor function called myclass. , create object obj out of it. obj inherits myclass.prototype. here question:

where myclass.prototype from? plain object constructor property?

thanks answers.

// constructor function myclass() { }  var obj = new myclass;  // object inherits myclass.prototype obj.__proto__ == myclass.prototype; // => true  // myclass.prototype inherits object.prototype myclass.prototype.__proto__ == object.prototype; // => true 

where myclass.prototype from?

it's implicitly created when function object (myclass) created.

is plain object constructor property?

yes, exactly. no more that, no magic involved :-)


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -