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

Testing controller

------Controller------------- @RestController @RequestMapping("/items") public class ItemController {     private final ItemServic...