Wednesday, September 8, 2021

Inheritance in javascript

 


javascript is a prototype based programming language that means inheritance is possible by using prototype.Every object has this prototype property .

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

Element of a good table (Ref: Database design mere mortals by Michael J. Hernandez)

  Elements of the Ideal Table: It represents a single subject, which can be an object or event that reduces the risk of potential data integ...