I do not understand this thing, but the process of recording their own practice, hope to accumulate to a certain extent, can be natural and yet understanding. A lot of things I was so slowly understand, understand why it is like that, really very magical oh. Stop talking nonsense and get started.
function Person () {this. age= "AAA";} var p1=New person ();p 1.age; // AAA
From the picture we can see that p1.__proto__ and Person.prototype are not included in the age attribute
p1.__proto__ ==person.prototype
I'll create the student object again.
functionthis. Noid= "A110";} Student.prototype
From the picture we can see that Student.prototype also does not contain the Noid attribute
Now let's do this.
Let's take a student and see what happens.
New Person ();
The display results are the same as the P1.
person {age: "AAA"}
Again
student.prototype=New person (); Student;
At this time the student is still the same, without any change.
I continue to experiment, at this time instance a student;
var st1=New Student (); st1;st1.__proto__;
Found that st1.__proto__ is not the same as p1.__proto__.
ST1.__PROTO__ is the value after the person instance
And p1.__proto__ is the person native structure
In view
At this point the St1 instance already has both the student and the person attributes, which is what we say St1 inherits the person.
A little confusing, see how Daniel explains--the article
JavaScript prototype understanding