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
+1 -1
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';