JavaScript Object.getPrototypeOf() Method
The Object.getPrototypeOf() static method returns the prototype of an object: the object it inherits properties from.
Description
The Object.getPrototypeOf() static method returns the prototype of an object, the object that it inherits from. It is the standard replacement for the old __proto__ property. The matching Object.setPrototypeOf() changes a prototype, but doing so is slow and best avoided.
Prototype chains end with Object.prototype, whose own prototype is null. Walking up the chain with repeated calls shows every object a value inherits from, which can help when debugging how a class hierarchy is put together.
Primitive values are converted to their wrapper objects first, so Object.getPrototypeOf('a') is String.prototype. For checking whether an object inherits from a class, the instanceof operator or isPrototypeOf() are usually more direct.
Syntax
Object.getPrototypeOf(obj)Parameters
- objThe object to work with.
Return Value
The prototype of the object, or null if it has none.
Example
Browser Support
The following information will show you the current browser support for the Object.getPrototypeOf() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





