Prototypal Inheritance in Function Objects
This lesson teaches the concept of prototypal inheritance in function objects as well as property shadowing.
Prototypal inheritance from Object
How does prototypal inheritance/prototype chaining work when constructor functions are used to create objects? In a previous chapter, we discussed the Prototype object of the constructor functions.
It was concluded that all the properties (including methods) that were added to the prototype of the constructor function could be shared by the object instances created from it. Let’s dive into the details now.
As mentioned earlier every, constructor function initialized has a prototype property assigned to it known as the Prototype Object. It contains the properties constructor
and __proto__
that sets the object’s [[Prototype]]
property. Its [[Prototype]]
is set to null
. All the object instances created will have their [[Prototype]]
reference to the prototype object. This was seen in a previous chapter through the following images:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy