How Inheritance works behind the scene?
Every js object has a prototype property .If any object want to inherit the property /method then these method and property will store in prototype property .Here the person prototype property is the prototype of john .
By default person constructor's biggest constructor is object.
In this fig person object can inherit the prototype of object and john can access the property of person prototype and object prototype.
No comments:
Post a Comment