|
1 | | -# Operators |
| 1 | +# Operatoriai |
2 | 2 |
|
3 | | -We know many operators from school. They are things like addition `+`, multiplication `*`, subtraction `-`, and so on. |
| 3 | +Mes žinome daug operatorių iš mokyklos. Tokie kaip sudėtis `+`, daugyba `*`, atimtis `-` ir taip toliau. |
4 | 4 |
|
5 | | -In this chapter, we'll concentrate on aspects of operators that are not covered by school arithmetic. |
| 5 | +Šiame skyriuje, susikoncentruosime prie tokio operatorių aspekto, kuris nėra aptariamas mokykloje. |
6 | 6 |
|
7 | | -## Terms: "unary", "binary", "operand" |
| 7 | +## Terminai: "unary", "binary", "operand" |
8 | 8 |
|
9 | | -Before we move on, let's grasp some common terminology. |
| 9 | +Prieš tęsiant, išsiaiškinkime įprastinę terminologiją. |
10 | 10 |
|
11 | | -- *An operand* -- is what operators are applied to. For instance, in the multiplication of `5 * 2` there are two operands: the left operand is `5` and the right operand is `2`. Sometimes, people call these "arguments" instead of "operands". |
12 | | -- An operator is *unary* if it has a single operand. For example, the unary negation `-` reverses the sign of a number: |
| 11 | +- *An operand* -- operandas yra tai kam operatoriai yra naudojami. Pavyzdžiui šioje daugyboje `5 * 2` yra du operandai: kairysis operandas yra `5`, o dešinysis yra `2`. Kartais žmonės juos vadina argumentais, o ne operandais. |
| 12 | +- Operatorius yra *unarinis* (ang. *unary*), jeigu turi vieną operandą. Pavyzdžiui unarinis neiginys (ang. negation) `-` paverčia skaičių neigiamu: |
13 | 13 |
|
14 | 14 | ```js run |
15 | 15 | let x = 1; |
16 | 16 |
|
17 | 17 | *!* |
18 | 18 | x = -x; |
19 | 19 | */!* |
20 | | - alert( x ); // -1, unary negation was applied |
| 20 | + alert( x ); // -1, pritaikytas unarinis neiginys |
21 | 21 | ``` |
22 | | -- An operator is *binary* if it has two operands. The same minus exists in binary form as well: |
| 22 | +- Operatorius yra *binarinis* (ang. *binary*) kai turi du operandus. Tas pats minusas egzistuoja ir binarinėse formose: |
23 | 23 |
|
24 | 24 | ```js run no-beautify |
25 | 25 | let x = 1, y = 3; |
26 | | - alert( y - x ); // 2, binary minus subtracts values |
| 26 | + alert( y - x ); // 2, binarinis minusas atima vertes |
27 | 27 | ``` |
28 | 28 |
|
29 | | - Formally, in the examples above we have two different operators that share the same symbol: the negation operator, a unary operator that reverses the sign, and the subtraction operator, a binary operator that subtracts one number from another. |
| 29 | + Formaliai aukščiau esančiame pavyzdyje mes turime du skirtingus operatorius, kurie dalinasi tuo pačiu simboliu: neigimo operatorių, t.y. unarinį operatorių, kuris pakeičia simbolį, ir atimties operatorių, t.y. binarinį operatorių, kuris atima vieną skaičių iš kito. |
30 | 30 |
|
31 | | -## String concatenation, binary + |
| 31 | +## Eilutės sujungimas, binarinis + |
32 | 32 |
|
33 | 33 | Now, let's see special features of JavaScript operators that are beyond school arithmetics. |
34 | 34 |
|
|
0 commit comments