Advanced JavaScript Tutorial in Hindi [Part 91] - Prototype and Prototypal Inheritance in JavaScript

Tech Gun
Youtube
Related Topic
:- Javascript Web Development

In this video i will talk about Prototype and Prototypal Inheritance in Javascript. In programming, we often want to take something and extend it. All JavaScript objects inherit properties and methods from a prototype. A JavaScript prototype is used to add new properties and methods to an existing object constructor. All JavaScript objects inherit properties and methods from a prototype: Date objects inherit from Date.prototype. Array objects inherit from Array.prototype. Player objects (from the example above) inherit from Player.prototype. The Object.prototype is on top of the prototype inheritance chain; ​ Date objects, Array objects, and Player objects all inherit from Object.prototype. For instance, we have a user object with its properties and methods, and want to make admin and guest as slightly modified variants of it. 

Comments