1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

Update reflect.md

This commit is contained in:
bigbird231 2019-05-08 12:05:03 +08:00 committed by GitHub
parent 8c9f2e4ef0
commit abc7310f11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,6 +273,7 @@ Reflect.deleteProperty(myObj, 'foo');
```
该方法返回一个布尔值。如果删除成功,或者被删除的属性不存在,返回`true`;删除失败,被删除的属性依然存在,返回`false`
如果第一个参数不是对象,`Reflect.deleteProperty`方法会报错。
### Reflect.construct(target, args)
@ -290,6 +291,8 @@ const instance = new Greeting('张三');
const instance = Reflect.construct(Greeting, ['张三']);
```
如果第一个参数不是函数,`Reflect.construct`方法会报错。
### Reflect.getPrototypeOf(obj)
`Reflect.getPrototypeOf`方法用于读取对象的`__proto__`属性,对应`Object.getPrototypeOf(obj)`