Object
ES6 standardizes the __proto__
property of an object and adds new properties to the global Object
object.
The __proto__ property
JavaScript objects have an internal [[prototype]]
property that references the object's prototype, that is, the object it inherits. To read the property we had to use Object.getPrototypeof()
and to create a new object with a given prototype we had to use the Object.create()
method. A [[prototype]]
property cannot be directly read or be modified.
Inheriting was cumbersome due to the nature of the [[prototype]]
property, therefore some browsers added a special __proto__
property in objects, which is an accessor property that exposes the internal [[prototype]]
property and makes working with prototypes easier. The ...
Get React: Building Modern Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.