Reflect.getPrototypeOf
静态方法 Reflect.getPrototypeOf()与Object.getPrototypeOf()方法是一样的。都是返回指定对象的原型(即,内部的 [[Prototype]]属性的值)。
语法
Reflect.getPrototypeOf(target)参数
target获取原型的目标对象。
返回值
给定对象的原型。如果没有继承的属性,则返回null。
异常
描述
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)The definition of 'Reflect.getPrototypeOf' in that specification. | Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262)The definition of 'Reflect.getPrototypeOf' in that specification. | Draft | |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
Basic support | 49 | (Yes) | 42 (42) | No support | No support | 10 |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
Basic support | No support | 49 | (Yes) | 42.0 (42) | No support | No support | 10 |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

