[First, this question may take the same concept as How JavaScript.prototype Works? , but has a different context .]
I met this blog which says:
In JavaScript, every object has a "prototype" property. prototype objects allows us to add properties to all instances of this object (even for existing instances).
According to my understanding, the above statement is misleading for beginners, as it does not distinguish between "prototype" and "[[Prototype]]". Not all objects have a prototype property, for example:
var myobject = {}; myobject.prototype;
I think it would be better if we said:
In JavaScript, every object has an internal property called "[[Prototype]]", which can be seen in some browsers by referring to a non-standard property called "__proto__". The prototype of objects allows you to add properties to all instances of this object (even for existing instances). Only functions (therefore, constructors) have a 'Prototype Property, which allows us to add properties to all instances of this object created by this function / constructor.
Is this a more accurate description of JavaScript prototypes, or am I missing something? Thanks in advance.
source share