When you create an object from the constructor in Google Chrome and display the name of the variable in which the object is saved, the identifier of the constructor is in front of the curly brackets, that is, the console MyConstructor {...} . What does it mean? As I know, the variable should contain the address of the object, but where did the name of the constructor come from before the curly braces, that is, the object ?? When executing code in other browsers or there is no such thing ...

 function MyConstructor() {}; var a = new MyConstructor(); console.log(a); 

    2 answers 2

    This is just debug information, the link to the constructor is available in the prototype.

     function MyConstructor() {}; var a = new MyConstructor(); console.log(a.__proto__.constructor); 

    • Thanks, now I understand everything) - Nikol Lakin

    Referring to the console.log specification, it can be noted that the Logger execution is indicated, with the parameter logLevel = "log".

    Going further we reach the execution of Printer , in which it is noted that this operation depends on the implementation .

    This means that each browser implements it the way it wants:

    Chrome, for example, depending on its internal conditions, can output the value of the constructor, or the internal field [[ToStringTag]] , or nothing.

    EDGE, for example, prints the string obtained by applying toString from Object.prototype to the passed object.