Skip to content

Commit 5986b84

Browse files
authored
Update article.md
1 parent 48acfe1 commit 5986b84

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

1-js/02-first-steps/08-operators/article.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ alert( +"" ); // 0
150150
151151
Бул чындыгында `Number(...)` менен бирдей, бирок көрүнүшү кыскараак.
152152
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 форманын талааларынын маанилери сап түрүндө болот. Аларды суммалайлы десек эмне кылыш керек?
154154
155155
Бинардык плюс аларды сап катары кошот:
156156
@@ -168,31 +168,32 @@ let apples = "2";
168168
let oranges = "3";
169169
170170
*!*
171-
// both values converted to numbers before the binary plus
171+
// эки маани бинардык плюсту колдонуудан мурун сандарга айландырылат
172172
alert( +apples + +oranges ); // 5
173173
*/!*
174174
175175
// узунураак вариант
176176
// alert( Number(apples) + Number(oranges) ); // 5
177177
```
178178
179-
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+
Математиктин көз карашы боюнча, плюстардын көптүгү кызыктай көрүнүшү мүмкүн. Бирок программисттин көз карашы боюнча, бул жерде өзгөчө эч нерсе жок: адегенде унардык плюстар колдонулат, алар саптарды сандарга айландырат, андан кийин бинардык плюс аларды жыйынтыктайт.
180180
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+
Эмнеге маанилерге унардык плюстар бинардык плюстардан мурун колдонулат? Төмөндө көрө турганыбыздай, бул алардын алгачкылыгына байланыштуу.
182182
183-
## Операторлордун приоритети
183+
## Операторлордун алгачкылыгы
184184
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+
Эгерде туюнтма бирден ашык операторго ээ болсо, аткаруу тартиби алардын *алгачкылыгы* же башкача айтканда, оператордук биринчиликтин демейки тартиби менен аныкталат.
186186
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+
Көбөйтүү кошууга караганда *жогору алгачкылыкка* ээ болот деп айтылат.
188189
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`.
190191
191-
There are many operators in JavaScript. 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'те көптөгөн операторлор бар. Ар бир оператордун ылайыктуу алгачкылык номуру бар. Саны көбүрөөк болгон оператор биринчи аткарылат. Эгерде алгачкылык бирдей болсо, анда солдон оңго карай аткарылат.
192193

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) үзүндү (баарын жаттап алуунун кереги жок, бирок унардык операторлордун алгачкылыгы ылайыктуу бинардык операторлорго караганда жогору экенин эске алыңыз):
194195

195-
| Приоритет | Аталыш | Белги |
196+
| Алгачкылык | Аталыш | Белги |
196197
|------------|------|------|
197198
| ... | ... | ... |
198199
| 14 | унардык плюс | `+` |
@@ -206,7 +207,7 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en-U
206207
| 2 | ыйрагуу | `=` |
207208
| ... | ... | ... |
208209

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"` туюнтмасында унардык плюс кошуудан мурун аткарылат.
210211

211212
## Ыйгаруу
212213

0 commit comments

Comments
 (0)