FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs(object): edit object · lpcman/es6tutorial@726e37e · GitHub

Commit 726e37e

Browse files
committed
docs(object): edit object
1 parent f4ce061 commit 726e37e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎docs/object.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ const fooInput = myForm.querySelector('input[name=foo]')
716716
const fooValue = fooInput ? fooInput.value : undefined
717717
```
718718

719-
这样的层层判断非常麻烦,因此 [ECMAScript2020](https://github.com/tc39/proposal-optional-chaining) 引入了“链判断运算符”(optional chaining operator)`?.`,简化上面的写法。
719+
这样的层层判断非常麻烦,因此 [ES2020](https://github.com/tc39/proposal-optional-chaining) 引入了“链判断运算符”(optional chaining operator)`?.`,简化上面的写法。
720720

721721
```javascript
722722
const firstName = message?.body?.user?.firstName || 'default';
@@ -843,7 +843,7 @@ const showSplashScreen = response.settings.showSplashScreen || true;
843843
844844
上面的三行代码都通过`||`运算符指定默认值,但是这样写是错的。开发者的原意是,只要属性的值为`null``undefined`,默认值就会生效,但是属性的值如果为空字符串或`false``0`,默认值也会生效。
845845
846-
为了避免这种情况,[ECMAScript2020](https://github.com/tc39/proposal-nullish-coalescing) 引入了一个新的 Null 判断运算符`??`。它的行为类似`||`,但是只有运算符左侧的值为`null``undefined`时,才会返回右侧的值。
846+
为了避免这种情况,[ES2020](https://github.com/tc39/proposal-nullish-coalescing) 引入了一个新的 Null 判断运算符`??`。它的行为类似`||`,但是只有运算符左侧的值为`null``undefined`时,才会返回右侧的值。
847847
848848
```javascript
849849
const headerText = response.settings.headerText ?? 'Hello, world!';

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL