What Is Prototypal Inheritance in JavaScript?

Prototypal inheritance lets objects inherit properties and methods directly from other objects via a prototype chain, rather than from a class blueprint as i...

Published November 20, 2026

In JavaScript every object has a hidden link to another object called its prototype. When you read a property that is missing, the engine follows this prototype chain until it finds it or reaches null. Classes are syntax on top of this mechanism.

The concept

Object.getPrototypeOf(obj) returns the prototype. Methods defined on the prototype are shared by all instances instead of being copied.

The chain ends at Object.prototype, then null. Setting a property writes to the object itself and never to the prototype.

Lookup walks up the chain

__proto____proto__dogown: nameAnimal.prototypespeak()Object.prototypetoString()
dog.speak → not on dog → found on Animal.prototype.

Practical examples

Object.create

const animal = { speak() { return this.name + ' makes a sound' } }
const dog = Object.create(animal)
dog.name = 'Rex'
dog.speak() // 'Rex makes a sound'

Constructor + prototype

function Person(n) { this.name = n }
Person.prototype.hi = function () { return 'Hi ' + this.name }
new Person('Ada').hi()

class is sugar

class A { hi() {} }
Object.getPrototypeOf(new A()) === A.prototype // true

Own vs inherited

dog.hasOwnProperty('name')  // true
'speak' in dog              // true (inherited)

Common mistakes

  • Defining methods inside constructors so each instance gets a copy.
  • Modifying built-in prototypes.
  • Confusing __proto__ with the prototype property of functions.

Key takeaways

  • Objects link to prototypes.
  • Lookups walk the chain.
  • Classes are sugar over prototypes.

FAQ

__proto__ vs prototype?

prototype is a function property used by new; __proto__ is an instance's actual link.

How do I check the chain?

Object.getPrototypeOf(obj) and instanceof.

More JavaScript articles