You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/08-operators/article.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -211,9 +211,9 @@ JavaScript'те көптөгөн операторлор бар. Ар бир оп
211
211
212
212
## Ыйгаруу
213
213
214
-
Let's note that an assignment `=` is also an operator. It is listed in the precedence table with the very low priority of `2`.
214
+
Ыйгаруу `=`да оператор экенин белгилей кетели. Ал алгачкылык жадыбалында өтө төмөн `2` алгачкылыгы менен келтирилген.
215
215
216
-
That's why, when we assign a variable, like`x = 2 * 2 + 1`, the calculations are done first and then the `=`is evaluated, storing the result in`x`.
216
+
Ошондуктан, биз өзгөрмөгө маани ыйгарганыбызда, мис.`x = 2 * 2 + 1`, адегенде эсептөөлөр аткарылып, андан кийин ыйгаруу `=`аткарылып, натыйжа `x` өзгөрмөсүндө сакталат.
217
217
218
218
```js
219
219
let x = 2 * 2 + 1;
@@ -223,13 +223,13 @@ alert( x ); // 5
223
223
224
224
### Ыйгаруу = маанини кайтарат
225
225
226
-
The fact of`=`being an operator, not a "magical" language construct has an interesting implication.
226
+
`=`"сыйкырдуу" тил түзүлүшү эмес, оператор экенинин фактысы кызыктуу мааниге ээ.
227
227
228
-
All operators inJavaScriptreturn a value. That's obvious for `+` and `-`, but also true for `=`.
228
+
JavaScript'теги бардык операторлор маанини кайтарышат. Бул `+` жана `-` үчүн айкын, бирок `=` үчүн да дурус.
229
229
230
-
The call `x = value` writes the `value` into `x` *and then returns it*.
230
+
`x = value` чакыруусу `value`'ну `x`ичине жазат *жана аны кайтарат*.
231
231
232
-
Here's a demo that uses an assignment as part of a more complex expression:
232
+
Бул жерде ыйгарууну татаалыраак туюнтманын бир бөлүгү катары колдонгон демонстрация келтирилген:
233
233
234
234
```js run
235
235
let a = 1;
@@ -243,15 +243,15 @@ alert( a ); // 3
243
243
alert( c ); // 0
244
244
```
245
245
246
-
In the example above, the result of expression `(a = b + 1)`is the value which was assigned to `a`(that is `3`). It is then used for further evaluations.
246
+
Жогорудагы мисалда `(a = b + 1)`туюнтмасынын натыйжасы `a`өзгөрмөсүнө ыйгарылган маани (б.а. `3`) болот. Андан кийин ал кийинки эсептөөлөр үчүн колдонулат.
247
247
248
-
Funny code, isn't it? We should understand how it works, because sometimes we see it in JavaScript libraries.
248
+
Укмуштай код, туурабы? Биз анын кантип иштээрин түшүнүшүбүз керек, анткени кээде биз аны JavaScript китепканаларынан көрө алабыз.
249
249
250
-
Although, please don't write the code like that. Such tricks definitely don't make code clearer or readable.
250
+
Бирок, сураныч, мындай код жазбаңыз. Бул трюктар, албетте, кодуңузду түшүнүктүү же окула тургандай кылбайт.
251
251
252
-
### Чынжырча ыйгаруу
252
+
### Чынжырча ыйгаруусу
253
253
254
-
Another interesting feature is the ability to chain assignments:
254
+
Дагы бир кызыктуу өзгөчөлүк - чынжырча ыйгаруу мүмкүнчүлүгү:
255
255
256
256
```js run
257
257
let a, b, c;
@@ -265,16 +265,17 @@ alert( b ); // 4
265
265
alert( c ); // 4
266
266
```
267
267
268
-
Chained assignments evaluate from right to left. First, the rightmost expression `2 + 2` is evaluated and then assigned to the variables on the left: `c`, `b` and `a`. At the end, all the variables share a single value.
268
+
Чынжырча ыйгаруулар оңдон солго карай аткарылат. Биринчиден, эң оң жактагы`2 + 2`туюнтмасы аткарылып, андан кийин сол жактагы өзгөрмөлөргө ыйгарылат:`c`, `b`жана`a`. Аягында, бардык өзгөрмөлөр бир жалпы мааниге ээ болот.
269
269
270
-
Once again, for the purposes of readability it's better to split such code into few lines:
270
+
Дагы бир жолу, окууга ыңгайлуу болуу үчүн мындай кодду бир нече сапка бөлүү жакшыраак:
271
271
272
272
```js
273
273
c = 2 + 2;
274
274
b = c;
275
275
a = c;
276
276
```
277
-
That's easier to read, especially when eye-scanning the code fast.
277
+
278
+
Айрыкча кодду тез карап жатканда, муну окууга оңоюраак.
0 commit comments