Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba9b7cb

Browse files
authored
Update article.md
1 parent b510417 commit ba9b7cb

File tree

1 file changed

+22
-22
lines changed
  • 1-js/02-first-steps/11-logical-operators

1 file changed

+22
-22
lines changed

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Logical operators
1+
# Логикалык операторлор
22

3-
There are four logical operators in JavaScript: `||` (OR), `&&` (AND), `!` (NOT), `??` (Nullish Coalescing). Here we cover the first three, the `??` operator is in the next article.
3+
JavaScript'те төрт логикалык оператор бар: `||` (ЖЕ), `&&` (ЖАНА), `!` (ЭМЕС), `??` (Нөлдүк биригүү оператору). Бул жерде биз биринчи үчөөнү караштырабыз, `??` оператору кийинки бөлүмдө болот.
44

5-
Although they are called "logical", they can be applied to values of any type, not only boolean. Their result can also be of any type.
5+
Алар "логикалык" деп аталганы менен, логикалык гана эмес, ар кандай түрдөгү маанилерге колдонулушу мүмкүн. Алардын натыйжасы да ар кандай түрдө болушу мүмкүн.
66

7-
Let's see the details.
7+
Кененирээк карап көрөлү.
88

9-
## || (OR)
9+
## || (ЖЕ)
1010

11-
The "OR" operator is represented with two vertical line symbols:
11+
"ЖЕ" оператору эки вертикалдуу сызык белгиси менен көрсөтүлөт:
1212

1313
```js
1414
result = a || b;
1515
```
1616

17-
In classical programming, the logical OR is meant to manipulate boolean values only. If any of its arguments are `true`, it returns `true`, otherwise it returns `false`.
17+
Классикалык программалоодо логикалык ЖЕ логикалык маанилерди гана башкарууга үчүн арналган. Эгерде анын аргументтеринин бири `true` болсо, `true` кайтарылат, антпесе `false` кайтарылат.
1818

19-
In JavaScript, the operator is a little bit trickier and more powerful. But first, let's see what happens with boolean values.
19+
JavaScript'те бул оператор бир аз татаалыраак жана күчтүүрөөк. Бирок адегенде логикалык маанилер менен эмне болорун карап көрөлү.
2020

21-
There are four possible logical combinations:
21+
Төрт мүмкүн болгон логикалык комбинациясы бар:
2222

2323
```js run
2424
alert( true || true ); // true
@@ -27,50 +27,50 @@ alert( true || false ); // true
2727
alert( false || false ); // false
2828
```
2929

30-
As we can see, the result is always `true` except for the case when both operands are `false`.
30+
Көрүнүп тургандай, эки операнд тең `false` болгондон башкасы, натыйжасы ар дайым `true` болот.
3131

32-
If an operand is not a boolean, it's converted to a boolean for the evaluation.
32+
Эгерде операнд логикалык эмес болсо, анда ал эсептөө үчүн логикалык түргө айландырылат.
3333

34-
For instance, the number `1` is treated as `true`, the number `0` as `false`:
34+
Мисалы үчүн, `1` саны `true`, `0` саны `false` катары каралат:
3535

3636
```js run
37-
if (1 || 0) { // works just like if( true || false )
38-
alert( 'truthy!' );
37+
if (1 || 0) { // if( true || false ) сыяктуу иштейт
38+
alert( 'чындык!' );
3939
}
4040
```
4141

42-
Most of the time, OR `||` is used in an `if` statement to test if *any* of the given conditions is `true`.
42+
Көбүнчө ЖЕ `||` оператору `if` нускамасында берилген шарттардын *кайсынысы болбосун* `true` экенин текшерүү үчүн колдонулат.
4343

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

4646
```js run
4747
let hour = 9;
4848

4949
*!*
5050
if (hour < 10 || hour > 18) {
5151
*/!*
52-
alert( 'The office is closed.' );
52+
alert( 'Кеңсе жабылды.' );
5353
}
5454
```
5555

56-
We can pass more conditions:
56+
Биз көбүрөөк шарттарды бере алабыз:
5757

5858
```js run
5959
let hour = 12;
6060
let isWeekend = true;
6161

6262
if (hour < 10 || hour > 18 || isWeekend) {
63-
alert( 'The office is closed.' ); // it is the weekend
63+
alert( 'Кеңсе жабылды.' ); // бул дем алыш күндөрү
6464
}
6565
```
6666

67-
## OR "||" finds the first truthy value [#or-finds-the-first-truthy-value]
67+
## ЖЕ "||" биринчи чындык маанини табат [#or-finds-the-first-truthy-value]
6868

6969
The logic described above is somewhat classical. Now, let's bring in the "extra" features of JavaScript.
7070

71-
The extended algorithm works as follows.
71+
Кеңейтилген алгоритм төмөнкүдөй иштейт.
7272

73-
Given multiple OR'ed values:
73+
ЖЕ оператору менен бөлүнгөн бир нече маани берилди:
7474

7575
```js
7676
result = value1 || value2 || value3;

0 commit comments

Comments
 (0)