Prototype Property
This lesson explains the prototype property of objects and what __proto__ is used for by using an example.
We'll cover the following
__proto__
Property
In JavaScript, objects contain a property [[Prototype]]
that is hidden. This property either points to another object or is null
.
The [[Prototype]]
property of objects, i.e., anObject.[[Prototype]]
defines the prototype of anObject
. It is defined through the __proto__
property which is used as a setter/getter for the [[Prototype]]
property; i.e., __proto__
is used in order to access/set the [[Prototype]]
property of an object.
Syntax
Let’s take a look at the syntax for accessing and setting the [[Prototype]]
property of an object.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy