Object.getPrototypeOf()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The Object.getPrototypeOf()
static method returns the prototype
(i.e. the value of the internal [[Prototype]]
property) of the specified
object.
Try it
const prototype1 = {};
const object1 = Object.create(prototype1);
console.log(Object.getPrototypeOf(object1) === prototype1);
// Expected output: true
Syntax
js
Object.getPrototypeOf(obj)
Parameters
obj
-
The object whose prototype is to be returned.
Return value
The prototype of the given object, which may be null
.
Examples
Using getPrototypeOf
js
const proto = {};
const obj = Object.create(proto);
Object.getPrototypeOf(obj) === proto; // true
Non-object coercion
Specifications
Specification |
---|
ECMAScript® 2025 Language Specification # sec-object.getprototypeof |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getPrototypeOf |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.