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
Syntax
Object.getPrototypeOf(obj)
Parameters
| Parameter | Description |
|---|---|
obj |
The object to inspect or change. |
Return value
The prototype object, or null.
Examples
console.log(Object.getPrototypeOf([]) === Array.prototype, Object.getPrototypeOf({}) === Object.prototype);
Output
true true
class Animal {}
class Dog extends Animal {}
console.log(Object.getPrototypeOf(Dog.prototype) === Animal.prototype);
Output
true
Version history
| Version | Change |
|---|---|
| JavaScript ES5 | Added |
In other languages
type()· Python
Related
Object.setPrototypeOf()· Change the prototype of an existing object. It is slow in most engines; prefer Object.create() or classes.Object.create()· Create a new object with the given prototype (or null for an object with no inherited properties at all).- JavaScript Objects · tutorial