An interesting question may arise in the example above: what’s the value of this inside set fullName(value)? Where are the properties this.name and this.surname written: into user or admin?
The answer is simple: this is not affected by prototypes at all.
No matter where the method is found: in an object or its prototype. In a method call, this is always the object before the dot.
So, the setter call admin.fullName= uses admin as this, not user.
That is actually a super-important thing, because we may have a big object with many methods, and have objects that inherit from it. And when the inheriting objects run the inherited methods, they will modify only their own states, not the state of the big object.
The example code doesn't show these concepts. Also, these additions can make readers ask questions before the explanation of the example code.
"// obj.toString === obj.__proto__.toString == Object.prototype.toString"
It is look like JS code but it gives different result from what we want to get.
There is different kind of equality operator ant these give more confusing what is the purpose of these?
It can be better to separate this line into 2 line of code to make it sensible and readable.
Subject and code is already hard but there is no need to make readers ask unnecessary questions.
Replaced ":"s with ","s.
I edited these lines before, and thought they were a little awkward w/ ":"s, but didn't see fit to change it then. But now ","s seem clearly better. Think of it as successive approximations.
Wording changes to 2012 prototype history. "allowed to" without a "who" is not very grammatical. Could replace with "allowed us to" or "allowed the user to". I went with a different verb, but either of the others would be OK too.
Also a little punctuation change to 2015 history.