Skip to content

Commit 33c1d67

Browse files
committed
merging all conflicts
2 parents 3db0ce2 + 733ff69 commit 33c1d67

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

1-js/02-first-steps/12-nullish-coalescing-operator/article.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,21 @@ alert(firstName || lastName || nickName || "Anonymous"); // Supercoder
7777
*/!*
7878
```
7979
80+
<<<<<<< HEAD
8081
Αυτό ορίζει το `height` σε `100` εάν δεν έχει οριστεί.
82+
=======
83+
Historically, the OR `||` operator was there first. It's been there since the beginning of JavaScript, so developers were using it for such purposes for a long time.
84+
85+
On the other hand, the nullish coalescing operator `??` was added to JavaScript only recently, and the reason for that was that people weren't quite happy with `||`.
86+
87+
The important difference between them is that:
88+
- `||` returns the first *truthy* value.
89+
- `??` returns the first *defined* value.
90+
91+
In other words, `||` doesn't distinguish between `false`, `0`, an empty string `""` and `null/undefined`. They are all the same -- falsy values. If any of these is the first argument of `||`, then we'll get the second argument as the result.
92+
93+
In practice though, we may want to use default value only when the variable is `null/undefined`. That is, when the value is really unknown/not set.
94+
>>>>>>> 733ff697c6c1101c130e2996f7eca860b2aa7ab9
8195
8296
Ας συκγρίνουμε το `||`:
8397

1-js/11-async/03-promise-chaining/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ promise.then(function(result) {
7272
});
7373
```
7474

75-
What we did here is just several handlers to one promise. They don't pass the result to each other; instead they process it independently.
75+
What we did here is just adding several handlers to one promise. They don't pass the result to each other; instead they process it independently.
7676

7777
Here's the picture (compare it with the chaining above):
7878

0 commit comments

Comments
 (0)