1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

docs(object): fix #1004

This commit is contained in:
ruanyf 2020-09-02 00:53:24 +08:00
parent dd892f89ac
commit 4e14b40bfc

View File

@ -885,7 +885,7 @@ const showSplashScreen = response.settings.showSplashScreen ?? true;
const animationDuration = response.settings?.animationDuration ?? 300;
```
上面代码中,`response.settings`如果`null``undefined`就会返回默认值300。
上面代码中,如果`response.settings``null``undefined`,或者`response.settings.animationDuration``null``undefined`就会返回默认值300。也就是说,这一行代码包括了两级属性的判断。
这个运算符很适合判断函数参数是否赋值。