In order for new objects to automatically install a prototype, the prototype property is set to the constructor.
When creating an object through new, a reference from the prototype of the constructor function is written into its proto prototype.
The prototype property makes sense only with the constructor. A property with the name prototype can be specified on any object, but it has a special meaning only if it is assigned to the constructor function.
By itself, without calling the new operator, it does nothing at all, its only purpose is to specify proto for new objects.
The value of prototype can only be an object. Technically, anything can be written to this property.
However, when new is run, the prototype property will be used only if it is an object. A primitive value, such as a number or string, will be ignored.
For an arbitrary function, let's call it Person, the following is true:
The prototype of proto new objects created by new Person can be set using the Person.prototype property. The default value of Person.prototype is an object with a single constructor property containing a reference to Person. It can be used to get the function that created it from the object itself. However, JavaScript does not support the correctness of this property, so the programmer can change or delete it. The modern Object.create (proto) method can be emulated with prototype if you want it to work in IE8.
Answer your question - The prototype is put once it is easy to check
var test1 = new Test(); var test2 = new Test(); console.dir(test1); console.dir(test2);
See their property __ proto__
https://learn.javascript.ru/new-prototype
Test.prototype- a link to this object is added to the objects themselves, it is very easy to check, for example, add a field to the prototype and compare its value with all created objects, or just get prototypes of the created objects and just compare them - GrundyObject.getPrototypeOf()- Dmitriy Simushev