What is the need for __proto__? [duplicate]

2

What is the need for "__proto__" in an object? I just ran tests and realized that "__proto__" is not a property, but it can be indexed.

When I define a property in x object, this property is also available in "__proto__" , but when I do the vice versa the property is not available in x object.

"__proto__" seems similar to Object because it has some properties with the same name

Theglobalobjectseemstohave"__proto__" differently

Sowhatdoes"__proto__" make of so special in JavaScript? The differences between #__proto__ and Function # prototype make sense, but #__proto__ itself does not make sense.

    
asked by anonymous 13.10.2016 / 20:01

1 answer

1

__proto__ contains a reference to the internal prototype specified object. Can be used to define the prototype for an object.

The object or function inherits all new prototype methods and properties along with all methods and properties in the prototype chain of the new prototype. An object can have only a single prototype (not including inherited prototypes in the prototype chain) , so that when you call the __proto__ property, you replace the previous prototype.

I found this image interesting, I removed it from the response of the stackoverflow in English.

Therearealreadyexplanatoryexplanationsthatmaybehelpful:

17.10.2016 / 16:31