Reflect.getPrototypeOf()

静态方法 Reflect.getPrototypeOf()Object.getPrototypeOf() 方法是一样的。都是返回指定对象的原型(即,内部的 [[Prototype]] 属性的值)。

语法

Reflect.getPrototypeOf(target)

参数

target
获取原型的目标对象。

返回值

给定对象的原型。如果没有继承的属性,则返回 null

异常

抛出一个 Object

描述

Reflect.getPrototypeOf 返回指定对象的原型 (例如:内部的 [[Prototype]] 属性的值) 。

示例

使用 Reflect.getPrototypeOf()

Reflect.getPrototypeOf({}); // Object.prototype
Reflect.getPrototypeOf(Object.prototype); // null
Reflect.getPrototypeOf(Object.create(null)); // null

规范

Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
Reflect.getPrototypeOf
Standard Initial definition.
ECMAScript Latest Draft (ECMA-262)
Reflect.getPrototypeOf
Draft  

浏览器兼容性

Update compatibility data on GitHub
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
getPrototypeOf Chrome Full support 49 Edge Full support 12 Firefox Full support 42 IE No support No Opera Full support 36 Safari Full support 10 WebView Android Full support 49 Chrome Android Full support 49 Firefox Android Full support 42 Opera Android Full support 36 Safari iOS Full support 10 Samsung Internet Android Full support 5.0 nodejs Full support 6.0.0

Legend

Full support  
Full support
No support  
No support

相关链接