JavaScript (ES2026) reference · Object Methods

JavaScript Object.getPrototypeOf() Method

Return the prototype of an object: the object it inherits methods and properties from, or null.

JavaScript (ES2026) Since ES5

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

Object.getPrototypeOf(obj)

Parameters

ParameterDescription
obj The object to inspect or change.

Return value

The prototype object, or null.

Examples

Built-in prototypesTry it yourself
console.log(Object.getPrototypeOf([]) === Array.prototype, Object.getPrototypeOf({}) === Object.prototype);

Output

true true
Class inheritanceTry it yourself
class Animal {}
class Dog extends Animal {}
console.log(Object.getPrototypeOf(Dog.prototype) === Animal.prototype);

Output

true

Version history

VersionChange
JavaScript ES5Added

In other languages

Was this page helpful?