From 4e14b40bfcde1aae70edbed62d6c561073546a43 Mon Sep 17 00:00:00 2001 From: ruanyf Date: Wed, 2 Sep 2020 00:53:24 +0800 Subject: [PATCH] docs(object): fix #1004 --- docs/object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/object.md b/docs/object.md index 295608c..5b8395b 100644 --- a/docs/object.md +++ b/docs/object.md @@ -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。也就是说,这一行代码包括了两级属性的判断。 这个运算符很适合判断函数参数是否赋值。