Object.getPrototypeOf()
The Object.getPrototypeOf()
method returns the prototype
(i.e. the value of the internal [[Prototype]]
property) of the specified
object.
Try it
Syntax
Object.getPrototypeOf(obj)
Parameters
obj
-
The object whose prototype is to be returned.
Return value
The prototype of the given object. If there are no inherited properties,
null
is returned.
Examples
Using getPrototypeOf
var proto = {};
var obj = Object.create(proto);
Object.getPrototypeOf(obj) === proto; // true
Non-object coercion
Specifications
Specification |
---|
ECMAScript Language Specification # sec-object.getprototypeof |
Browser compatibility
BCD tables only load in the browser
Opera-specific notes
Even though older Opera versions don't support Object.getPrototypeOf()
yet, Opera supports the non-standard __proto__
property
since Opera 10.50.