docs(object): fix #931

This commit is contained in:
ruanyf
2019-12-07 22:08:20 +08:00
parent add1bb8f82
commit c4f4570f67
+4 -2
View File
@@ -794,7 +794,9 @@ a == null ? undefined : delete a.b
上面代码中,如果`a``undefined``null`,会直接返回`undefined`,而不会进行`delete`运算。
3)括号不改变运算顺序
3)括号的影响
如果属性链有圆括号,链判断运算符对圆括号外部没有影响,只对圆括号内部有影响。
```javascript
(a?.b).c
@@ -802,7 +804,7 @@ a == null ? undefined : delete a.b
(a == null ? undefined : a.b).c
```
上面代码中,`?.`对圆括号没有影响,不管`a`对象是否存在,圆括号后面的`.c`总是会执行。
上面代码中,`?.`对圆括号外部没有影响,不管`a`对象是否存在,圆括号后面的`.c`总是会执行。
一般来说,使用`?.`运算符的场合,不应该使用圆括号。