mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 05:24:10 +03:00
Merge pull request #154 from Keivan-sf/patch-2
Add: Nullish coalescing operator
This commit is contained in:
1 file changed
+9
@@ -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' // ''
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user