1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-29 05:42:20 +00:00

Merge pull request #671 from Tomotoes/patch-1

Update proxy.md
This commit is contained in:
Ruan YiFeng 2018-05-17 22:41:27 +08:00 committed by GitHub
commit e3769745ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -503,6 +503,8 @@ Reflect.apply(proxy, null, [9, 10]) // 38
`has`方法用来拦截`HasProperty`操作,即判断对象是否具有某个属性时,这个方法会生效。典型的操作就是`in`运算符。
`has`方法可以接受两个参数,分别是目标对象、需查询的属性名。
下面的例子使用`has`方法隐藏某些属性,不被`in`运算符发现。
```javascript
@ -579,7 +581,7 @@ for (let b in oproxy2) {
// 99
```
上面代码中,`has`拦截只对`in`运算符生效,对`for...in`循环不生效,导致不符合要求的属性没有被排除在`for...in`循环之外
上面代码中,`has`拦截只对`in`运算符生效,对`for...in`循环不生效,导致不符合要求的属性没有被`for...in`循环所排除
### construct()
@ -596,7 +598,7 @@ var handler = {
`construct`方法可以接受两个参数。
- `target`: 目标对象
- `args`:构函数的参数对象
- `args`:构函数的参数对象
下面是一个例子。