1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-25 19:22:21 +00:00

Update proxy.md

1. 纠正错别字 
> **构建函数** 为 构造函数
2. 纠正语义 
> 有被`for...in`循环所排除。
3. 增加
> `has` 方法的参数说明
This commit is contained in:
Simon Ma 2018-05-16 20:43:29 +08:00 committed by GitHub
parent 7d5a56292a
commit 9708a21581
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`:构函数的参数对象
下面是一个例子。