Skip to content

Comparison #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

```js no-beautify
5 > 4 → true
"apple" > "pineapple" → false
"ананас" > "яблуко" → false
"2" > "12" → true
undefined == null → true
undefined === null → false
null == "\n0\n" → false
null === +"\n0\n" → false
```

Some of the reasons:
Ось чому такі результати:

1. Obviously, true.
2. Dictionary comparison, hence false.
3. Again, dictionary comparison, first char of `"2"` is greater than the first char of `"1"`.
4. Values `null` and `undefined` equal each other only.
5. Strict equality is strict. Different types from both sides lead to false.
6. See (4).
7. Strict equality of different types.
1. Очевидно, 5 більше за 4. true.
2. Посимвольне порівняння, тому `false`.
3. Знову посимвольне порівняння. Перший символ рядка `"2"` більший за перший символ другого рядка — `"1"`.
4. Спеціальний випадок. Значення `null` і `undefined` рівні під час не строгого порівняння.
5. Строге порівняння різних типів, тому `false`.
6. Дивіться (4).
7. Строге порівняння різних типів.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ importance: 5

---

# Comparisons
# Оператори порівняння

What will be the result for these expressions?
Який буде результат порівняння цих виразів?

```js no-beautify
5 > 4
"apple" > "pineapple"
"ананас" > "яблуко"
"2" > "12"
undefined == null
undefined === null
Expand Down
Loading