What is the inheritance model used by JavaScript?

The story behind the answer

JavaScript uses prototypal inheritance. Objects can inherit properties and methods through links to other objects called prototypes, forming a prototype chain that JavaScript follows when a requested property is not found directly on the object.

This model differs from classical inheritance, where objects are normally instances of classes and classes inherit from other classes. In JavaScript, objects can be created directly with object literals or with functions and constructors, and behavior can be shared through their prototypes.

The `class` and `extends` syntax introduced with ECMAScript 2015 can make JavaScript look class-based, but it is primarily a more familiar interface over the existing prototype system. A class declaration still creates constructor and prototype relationships underneath.

A common mistake is to treat an object’s `prototype` property and its internal prototype link as identical in every context. Functions expose a `prototype` property used for instances created with `new`, while objects have an internal prototype relationship that can be inspected with methods such as `Object.getPrototypeOf()`. Property lookup continues along that chain until a match or its end is reached.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: