* Inheritance and the prototype chain - JavaScript.
* JavaScript implements inheritance by using objects. Each object has an internal link to another object called its prototype.
* Prototypes are hidden objects that are used to share the properties and methods of a parent class to child classes.
live result link:- https://playcode.io/1943752
/* * Inheritance and the prototype chain - JavaScript.
* JavaScript implements inheritance by using objects. Each object has an
internal link to another object called its prototype.
* Prototypes are hidden objects that are used to share the properties
and methods of a parent class to child classes.
*/
var obj1 ={
id:1,
name:"Anil",
isActive:true,
age:39
}
var obj2 ={
address:'Gaur City 2',
pin:201306,
__proto__:obj1
}
console.log(obj2);