Javascript: Why is a constructor's __proto__ property Empty() { }? -



Javascript: Why is a constructor's __proto__ property Empty() { }? -

this question has reply here:

what - function empty() - in javascript ? [duplicate] 1 reply

i created simple constructor like:

function car() { this.notires = 5; }

car.__proto__ prints out empty() {}

what mean?

protoype property of every constructor object prototype of new instance. can define this.

car.prototype.name="audi"; car.prototype.model="a4";

making constructor not mean making prototype. prototypes used when want create instances pointeng same block eg.

function person(){ } person.prototype.name = "detailer"; person.prototype.age = 17; person.prototype.job ="developer" person.prototype.sayname = function(){ alert(this.name); }; var person1 = new person(); var person2 = new person(); person1.name = "lakshay"; alert(person1.name); //lakshay - instance alert(person2.name); //detailer - prototype

javascript

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -