Home > front end >  Js problem function prototype structure
Js problem function prototype structure

Time:09-27



Excuse me: why did the first print constructor constructor will have weight: 130; After the second print output weight: 130 and constructor constructor;
If no instance helson second print is still the same, the predecessors to explain?

CodePudding user response:

Because the console. The log () object or array is in the console output shows an object or an array of references,

That is in the console. The log () output array or object, the object (array) attribute is fold does not display,
If you are in the console. The log () output after change the attributes of the object (array), when you click the triangle on attributes will reread object (array) current attributes, namely is displayed when you click the triangle on the attributes, rather than performing the console. The log () when the properties of the


CodePudding user response:

reference 1/f, the sky wave response:
because the console. The log () object or array is in the console output shows an object or an array of references,

That is in the console. The log () output array or object, the object (array) attribute is fold does not display,
If you are in the console. The log () output after change the attributes of the object (array), when you click the triangle on attributes will reread object (array) current attributes, namely is displayed when you click the triangle on the attributes, rather than the execution of the console. The log () when the properties of the
that would you please tell me why I don't have the assignment weight before or can the weight value is displayed in the constructor?

CodePudding user response:

When you click on the triangle expansion properties, weight assignment

CodePudding user response:

This output was no problem
The console. The log (Person) prototype) weight);
Person. The prototype. Weight=130;
The console. The log (Person) prototype) weight);

CodePudding user response:

CodePudding user response:


In a statement the Person before this function if you have the prototype of the constructor added weight attribute?
  • Related