Merge pull request #154 from Keivan-sf/patch-2

Add: Nullish coalescing operator
This commit is contained in:
Randy8080 authored and GitHub committed 2022-02-07 14:00:06 +08:00
commit 2363f54055
1 file changed
+9
+9
View File
@@ -208,6 +208,15 @@ let oppositeValue = !lateToWork;
// => false
console.log(oppositeValue);
```
#### Nullish coalescing operator ??
```javascript
null ?? 'I win'; // 'I win'
undefined ?? 'Me too'; // 'Me too'
false ?? 'I lose' // false
0 ?? 'I lose again' // 0
'' ?? 'Damn it' // ''
```