Prototypal Inheritance using __proto__ in JavaScript Last Updated : 02 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Every object with its methods and properties contains an internal and hidden property known as [[Prototype]]. The Prototypal Inheritance is a feature in javascript used to add methods and properties in objects. It is a method by which an object can inherit the properties and methods of another object. Traditionally, in order to get and set the [[Prototype]] of an object, we use Object.getPrototypeOf and Object.setPrototypeOf. Nowadays, in modern language, it is being set using __proto__. Syntax: ChildObject.__proto__ = ParentObject Example In the given example, there are two objects 'person' and 'GFGuser'. The object 'GFGuser' inherits the methods and properties of the object 'person' and further uses them. html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>prototype</title> </head> <body> <script> // object person let person = { talk: true, Canfly() { return "Sorry, Can't fly"; }, }; // Object GFGuser let GFGuser = { CanCode: true, CanCook() { return "Can't say"; }, // Inheriting the properties and methods of person __proto__: person, }; // Printing on console // Property of person console.log("Can a GFG User talk: " + GFGuser.talk); // Method of person console.log("Can a GFG User fly: " + GFGuser.Canfly()); // Property of GFGuser console.log("Can a GFG User code: " + GFGuser.CanCode); // Method of GFGuser console.log("Can a GFG User cook: " + GFGuser.CanCook()); </script> </body> </html> Output Comment More infoAdvertise with us Next Article JavaScript String prototype Property H hacksight Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Misc Similar Reads Prototype Inheritance in JavaScript Prototype inheritance in JavaScript allows objects to inherit properties and methods from other objects. Each object in JavaScript has an internal link to another object called its prototype. This chain of prototypes forms the prototype chain.When you access a property or method on an object, JavaSc 3 min read JavaScript String prototype Property The prototype property allows to add new properties and methods to the existing JavaScript object types. There are two examples to describe the JavaScript String prototype property. Syntax: object.prototype.name = valueReturn Value: It returns a reference to the String.prototype object.Example 1: Th 2 min read JavaScript Date prototype Property The date.prototype property represents the prototype for the Date constructor. The prototype allows adding new properties, and methods. Below are examples of Date prototype Property. Example: javascript var birthday = new Date('June 21, 2018 16:44:23'); var date1 = birthday.getDate(); var day1 = bir 3 min read Understanding the Prototype Chain in JavaScript The prototype chain is a core JavaScript concept enabling the inheritance of properties and methods between objects. It facilitates code reuse, efficient property lookup, and object hierarchy creation.Every JavaScript object has an internal link to another object, called its prototype.The prototype 3 min read JavaScript Inheritance Inheritance is a fundamental concept in object-oriented programming (OOP) that allows one class or object to derive properties and behaviours from another. In JavaScript, inheritance is like a parent-child relationship, where objects, functions, or classes can inherit properties and methods from oth 6 min read Difference Between Objects and Prototypes in JavaScript Objects in JavaScriptThe Objects in JavaScript are instances of the class or constructors and they can hold properties and methods. These properties and methods can be unique to the object or inherited from the prototypes. The Objects can be created using the constructor functions, object literals, 3 min read Like