> For the complete documentation index, see [llms.txt](https://javascript-1.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascript-1.gitbook.io/javascript/prototypal-inheritance.md).

# Prototypal Inheritance

An object(Child) getting accessed to properties and functions of another object(Parent).

In JavaScript, Array and Functions are inherited from Object.

![Prototypal Inheritance](https://2037876129-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdbqCujxzeJqeQqlbM2%2F-LnXuBrbXAWs0T19qb8e%2F-LnY-SfIdDHo2bWopZUp%2Fimage.png?alt=media\&token=f60167b5-c026-4821-ba88-2d58c37da5a7)

we can see the parent object using `__proto__` property.

```javascript
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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain).
