Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ Reflect.apply(proxy, null, [9, 10]) // 38

`has`方法用来拦截`HasProperty`操作,即判断对象是否具有某个属性时,这个方法会生效。典型的操作就是`in`运算符。

`has`方法可以接受两个参数,分别是目标对象、需查询的属性名。

下面的例子使用`has`方法隐藏某些属性,不被`in`运算符发现。

```javascript
Expand Down Expand Up @@ -579,7 +581,7 @@ for (let b in oproxy2) {
// 99
```

上面代码中,`has`拦截只对`in`运算符生效,对`for...in`循环不生效,导致不符合要求的属性没有被排除在`for...in`循环之外
上面代码中,`has`拦截只对`in`运算符生效,对`for...in`循环不生效,导致不符合要求的属性没有被`for...in`循环所排除

### construct()

Expand All @@ -596,7 +598,7 @@ var handler = {
`construct`方法可以接受两个参数。

- `target`: 目标对象
- `args`:构建函数的参数对象
- `args`:构造函数的参数对象

下面是一个例子。

Expand Down