However, the first object i-e player1 will have age property but not the second object i-e player2. Similarly, p2.__proto__ also references the same object as p1.__proto__: As mentioned earlier, you should use the Object.getPrototypeOf() method instead of the __proto__.
Lets first discuss why we need prototypes. Never modify the prototypes of As you can see in the above example, Function's prototype property can be accessed using
If it does not find there then it uses studObj's __proto__ link which points to the prototype object of Student function.
The standard way to access an object's prototype is the Object.getPrototypeOf() method. I suggest you familiarise yourself with this introductory series on Object Oriented Programming before going further. Sometimes you want to add new properties (or methods) to an object