Object.getPrototypeOf()

Returns the prototype of the specified object.

Since ES5 Spec ↗

Syntax

Object.getPrototypeOf(obj)

Parameters

NameTypeRequiredDescription
obj object Yes The object whose prototype is returned.

Returns

object | null — The prototype, or null if there is none.

Examples

console.log(Object.getPrototypeOf([]) === Array.prototype);
Output
true
console.log(Object.getPrototypeOf(Object.create(null)));
Output
null

Notes

The standard way to read an object's prototype (preferred over the legacy `__proto__`). Returns null for objects created with `Object.create(null)`.

Browser & runtime support

EnvironmentSince version
chrome 5
firefox 3.5
safari 5
edge 12
node 0.10

See also