Prototypal Inheritance
An object(Child) getting accessed to properties and functions of another object(Parent).
In JavaScript, Array and Functions are inherited from Object.

we can see the parent object using __proto__
property.
Examples:
const arr = [];
console.log(arr.__proto__) // Array
console.log(arr.__proto__.__proto__) // Object
function a() {}
console.log(a.__proto__) // f[native code]
console.log(a.__proto__.__proto__) // Object
const obj = {};
console.log(a.__proto__) // Object
for more details check here.
Last updated
Was this helpful?