The _ PROTO _ attribute of an object and its internal attribute [[prototype] point to the same value (usually referred to as the prototype ), the prototype value can be an object value or null (for example, object. prototype. the value of _ PROTO _ is null ). this attribute may cause some errors, because the user may not know the particularity of this attribute and assign values to it, thus changing the prototype of this object. to access the prototype of an object, use the method object. getprototypeof.
When an object is created, its _ PROTO _ attribute and internal attribute [[prototype] point to the same object (that is, the prototype attribute of its constructor ). changing the value of the _ PROTO _ attribute also changes the value of the internal attribute [[prototype], unless the object is not extensible.
What is internal properties: http://my.oschina.net/xinxingegeya/blog/290167
Be aware that _ PROTO _ is not the same as prototype, since _ PROTO _ is a property of the instances (is an instance attribute) (objects ), whereas prototype is a propertyThe constructor FunctionsUsed to create those objects.
Consider another object called Monkey and use it as a prototype when creating objectsThe human () constructor.
VaR monkey = {feeds: 'banas', breathes: 'air'}; Function Human () {} human. prototype = monkey; // use the monkey object to override the prototype attribute var developer = new human (); developer. feeds = 'pizza'; developer. hacks = 'javascript '; console. log (developer. hacks); // javascriptconsole. log (developer. feeds); // pizzaconsole. log (developer. breathes); // airconsole. log (developer. _ PROTO _ = monkey); // trueconsole. log (typeof developer. _ PROTO _); // objectconsole. log (typeof developer. prototype); // undefinedconsole. log (typeof developer. constructor. prototype); // objectconsole. log (typeof developer. constructor); // Function
The secret link is exposed in most modern JavaScript environmentsThe _ PROTO _ Property(The word "Proto" with two underscores before and two after ).
Be aware that_ PROTO _ is not the same as prototype, Since _ PROTO _ is a property of the instances (objects), whereasPrototype is a property of the constructor functions used to create those objects.