Skip to content

Commit dc1eaa4

Browse files
authored
Update article.md
1 parent ef4651a commit dc1eaa4

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

1-js/02-first-steps/09-comparison/article.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
# Comparisons
1+
# Салыштыруу операторлору
22

3-
We know many comparison operators from maths.
3+
Көптөгөн салыштыруу операторлору бизге математикадан белгилүү.
44

5-
In JavaScript they are written like this:
5+
JavaScript'те алар мындай жазылат:
66

7-
- Greater/less than: <code>a &gt; b</code>, <code>a &lt; b</code>.
8-
- Greater/less than or equals: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
9-
- Equals: `a == b`, please note the double equality sign `==` means the equality test, while a single one `a = b` means an assignment.
10-
- Not equals: In maths the notation is <code>&ne;</code>, but in JavaScript it's written as <code>a != b</code>.
7+
- Чоң/кичине: <code>a &gt; b</code>, <code>a &lt; b</code>.
8+
- Чоң/кичине же барабар: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
9+
- Барабар: `a == b`, көңүл буруңуз, кош барабардык белгиси `==` салыштыруу үчүн колдонулат, ал эми жалгыз барабардык белгиси `a = b` ыйгарууну билдирчү.
10+
- Барабар эмес: Математикада <code>&ne;</code> белгиси менен белгиленет, бирок JavaScript'те <code>a != b</code> деп жазылат.
1111

1212
In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.
1313

1414
At the end you'll find a good recipe to avoid "JavaScript quirks"-related issues.
1515

16-
## Boolean is the result
16+
## Салыштыруунун натыйжасы логикалык түргө ээ
1717

18-
All comparison operators return a boolean value:
18+
Бардык салыштыруу операторлору логикалык түрдөгү маанини кайтарат:
1919

20-
- `true` -- means "yes", "correct" or "the truth".
21-
- `false` -- means "no", "wrong" or "not the truth".
20+
- `true` -- "ооба", "туура" же "чындыкты" билдирет.
21+
- `false` -- "жок", "туура эмес" же "жалганды" билдирет.
2222

23-
For example:
23+
Мисалы:
2424

2525
```js run
26-
alert( 2 > 1 ); // true (correct)
27-
alert( 2 == 1 ); // false (wrong)
28-
alert( 2 != 1 ); // true (correct)
26+
alert( 2 > 1 ); // true (туура)
27+
alert( 2 == 1 ); // false (туура эмес)
28+
alert( 2 != 1 ); // true (туура)
2929
```
3030

3131
A comparison result can be assigned to a variable, just like any value:
3232

3333
```js run
34-
let result = 5 > 4; // assign the result of the comparison
34+
let result = 5 > 4; // салыштыруунун натыйжасы result өзгөрмөсүнө ыйгарылат
3535
alert( result ); // true
3636
```
3737

38-
## String comparison
38+
## Саптарды салыштыруу
3939

4040
To see whether a string is greater than another, JavaScript uses the so-called "dictionary" or "lexicographical" order.
4141

4242
In other words, strings are compared letter-by-letter.
4343

44-
For example:
44+
Мисалы:
4545

4646
```js run
47-
alert( 'Z' > 'A' ); // true
48-
alert( 'Glow' > 'Glee' ); // true
49-
alert( 'Bee' > 'Be' ); // true
47+
alert( 'Я' > 'А' ); // туура (true)
48+
alert( 'Кант' > 'Калп' ); // туура (true)
49+
alert( 'Бала' > 'Бал' ); // туура (true)
5050
```
5151

52-
The algorithm to compare two strings is simple:
52+
Эки сапты салыштыруу алгоритми абдан жөнөкөй:
5353

5454
1. Compare the first character of both strings.
5555
2. If the first character from the first string is greater (or less) than the other string's, then the first string is greater (or less) than the second. We're done.
@@ -59,11 +59,11 @@ The algorithm to compare two strings is simple:
5959

6060
In the first example above, the comparison `'Z' > 'A'` gets to a result at the first step.
6161

62-
The second comparison `'Glow'` and `'Glee'` needs more steps as strings are compared character-by-character:
62+
Экинчи `'Кант'` жана `'Калп'` сөздөрүнүн салыштыруусу белгиден белгиге салыштырылат:
6363

64-
1. `G` is the same as `G`.
65-
2. `l` is the same as `l`.
66-
3. `o` is greater than `e`. Stop here. The first string is greater.
64+
1. `К` менен `К` барабар.
65+
2. `а` менен `а` барабар.
66+
3. `н` `л`ден чоңураак. Бул жерде салыштыруу бүтөт. Биринчи сап чоңураак.
6767

6868
```smart header="Not a real dictionary, but Unicode order"
6969
The comparison algorithm given above is roughly equivalent to the one used in dictionaries or phone books, but it's not exactly the same.
@@ -207,7 +207,7 @@ Why did we go over these examples? Should we remember these peculiarities all th
207207
- Treat any comparison with `undefined/null` except the strict equality `===` with exceptional care.
208208
- Don't use comparisons `>= > < <=` with a variable which may be `null/undefined`, unless you're really sure of what you're doing. If a variable can have these values, check for them separately.
209209

210-
## Summary
210+
## Корутунду
211211

212212
- Comparison operators return a boolean value.
213213
- Strings are compared letter-by-letter in the "dictionary" order.

0 commit comments

Comments
 (0)