1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-29 13:52:22 +00:00

Merge pull request #612 from yuu2lee4/patch-2

Null 传导运算符提案地址替换为tc39官方
This commit is contained in:
Ruan YiFeng 2018-02-25 23:25:49 -06:00 committed by GitHub
commit 0a65201d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,7 @@ const firstName = (message
&& message.body.user.firstName) || 'default';
```
这样的层层判断非常麻烦,因此现在有一个[提案](https://github.com/claudepache/es-optional-chaining)引入了“Null 传导运算符”null propagation operator`?.`,简化上面的写法。
这样的层层判断非常麻烦,因此现在有一个[提案](https://github.com/tc39/proposal-optional-chaining)引入了“Null 传导运算符”null propagation operator`?.`,简化上面的写法。
```javascript
const firstName = message?.body?.user?.firstName || 'default';