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
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,7 +150,7 @@ alert( +"" ); // 0
150
150
151
151
Бул чындыгында `Number(...)` менен бирдей, бирок көрүнүшү кыскараак.
152
152
153
-
The need to convert strings to numbers arises very often. For example, if we are getting values from HTML form fields, they are usually strings. What if we want to sum them?
153
+
Саптарды сандарга айландыруу зарылдыгы абдан көп пайда болот. Мисалы, адатта HTML форманын талааларынын маанилери сап түрүндө болот. Аларды суммалайлы десек эмне кылыш керек?
154
154
155
155
Бинардык плюс аларды сап катары кошот:
156
156
@@ -168,31 +168,32 @@ let apples = "2";
168
168
let oranges = "3";
169
169
170
170
*!*
171
-
// both values converted to numbers before the binary plus
171
+
// эки маани бинардык плюсту колдонуудан мурун сандарга айландырылат
From a mathematician's standpoint, the abundance of pluses may seem strange. But from a programmer's standpoint, there's nothing special: unary pluses are applied first, they convert strings to numbers, and then the binary plus sums them up.
179
+
Математиктин көз карашы боюнча, плюстардын көптүгү кызыктай көрүнүшү мүмкүн. Бирок программисттин көз карашы боюнча, бул жерде өзгөчө эч нерсе жок: адегенде унардык плюстар колдонулат, алар саптарды сандарга айландырат, андан кийин бинардык плюс аларды жыйынтыктайт.
180
180
181
-
Why are unary pluses applied to values before the binary ones? As we're going to see, that's because of their *higher precedence*.
181
+
Эмнеге маанилерге унардык плюстар бинардык плюстардан мурун колдонулат? Төмөндө көрө турганыбыздай, бул алардын алгачкылыгына байланыштуу.
182
182
183
-
## Операторлордун приоритети
183
+
## Операторлордун алгачкылыгы
184
184
185
-
If an expression has more than one operator, the execution order is defined by their *precedence*, or, in other words, the default priority order of operators.
185
+
Эгерде туюнтма бирден ашык операторго ээ болсо, аткаруу тартиби алардын *алгачкылыгы* же башкача айтканда, оператордук биринчиликтин демейки тартиби менен аныкталат.
186
186
187
-
From school, we all know that the multiplication in the expression `1 + 2 * 2` should be calculated before the addition. That's exactly the precedence thing. The multiplication is said to have *a higher precedence* than the addition.
187
+
`1 + 2 * 2` туюнтмасындагы көбөйтүүнү кошууга чейин эсептөө керек экенин мектептен биз баарыбыз билебиз. Алгачкылык дал ушул нерсе.
188
+
Көбөйтүү кошууга караганда *жогору алгачкылыкка* ээ болот деп айтылат.
188
189
189
-
Parentheses override any precedence, so if we're not satisfied with the default order, we can use them to change it. For example, write`(1 + 2) * 2`.
190
+
Кашаалар кандайдыр бир алгачкылыктан бийик турат, андыктан демейки тартип бизди канааттандырбаса, аларды өзгөртүү үчүн кашааларды колдоно алабыз. Мисалы, `(1 + 2) * 2`.
190
191
191
-
There are many operators inJavaScript. Every operator has a corresponding precedence number. The one with the larger number executes first. If the precedence is the same, the execution order is from left to right.
192
+
JavaScript'те көптөгөн операторлор бар. Ар бир оператордун ылайыктуу алгачкылык номуру бар. Саны көбүрөөк болгон оператор биринчи аткарылат. Эгерде алгачкылык бирдей болсо, анда солдон оңго карай аткарылат.
192
193
193
-
Here's an extract from the [precedence table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence) (you don't need to remember this, but note that unary operators are higher than corresponding binary ones):
194
+
Мына [алгачкылык жадыбалынан](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence) үзүндү (баарын жаттап алуунун кереги жок, бирок унардык операторлордун алгачкылыгы ылайыктуу бинардык операторлорго караганда жогору экенин эске алыңыз):
194
195
195
-
|Приоритет| Аталыш | Белги |
196
+
|Алгачкылык| Аталыш | Белги |
196
197
|------------|------|------|
197
198
|...|...|...|
198
199
|14| унардык плюс |`+`|
@@ -206,7 +207,7 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en-U
206
207
|2| ыйрагуу |`=`|
207
208
|...|...|...|
208
209
209
-
As we can see, the "unary plus" has a priority of`14`which is higher than the `11`of"addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
210
+
Көрүнүп тургандай, "унардык плюс"`14`алгачкылыгына ээ, ал "кошуунун" (бинардык плюстун) алгачкылыгынан --`11`ден жогору. Мына ошондуктан `"+apples + +oranges"` туюнтмасында унардык плюс кошуудан мурун аткарылат.
0 commit comments