mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-27 20:32:21 +00:00
docs(proxy): edit proxyw
This commit is contained in:
commit
36c2fdb05d
@ -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()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user