Skip to content

Commit c47f044

Browse files
authored
Merge pull request #77 from meilune/master
Translated the if statements
2 parents 5c81a53 + a4518ed commit c47f044

File tree

19 files changed

+166
-166
lines changed

19 files changed

+166
-166
lines changed

1-js/02-first-steps/11-logical-operators/1-alert-null-2-undefined/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer is `2`, that's the first truthy value.
1+
Atsakymas yra `2`, pirmoji truthy vertė.
22

33
```js run
44
alert( null || 2 || undefined );

1-js/02-first-steps/11-logical-operators/1-alert-null-2-undefined/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# What's the result of OR?
5+
# Koks bus ARBA rezultatas?
66

7-
What is the code below going to output?
7+
Ką atiduos žemiau esantis kodas?
88

99
```js
1010
alert( null || 2 || undefined );
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
The answer: first `1`, then `2`.
1+
Atsakymas yra: pirma `1`, tada `2`.
22

33
```js run
44
alert( alert(1) || 2 || alert(3) );
55
```
66

7-
The call to `alert` does not return a value. Or, in other words, it returns `undefined`.
7+
Šaukimas `alert` negrąžina jokios vertės. Arba kitaip sakant, jis grąžina `undefined`.
88

9-
1. The first OR `||` evaluates it's left operand `alert(1)`. That shows the first message with `1`.
10-
2. The `alert` returns `undefined`, so OR goes on to the second operand searching for a truthy value.
11-
3. The second operand `2` is truthy, so the execution is halted, `2` is returned and then shown by the outer alert.
9+
1. Pirmasis ARBA `||` įvertina kairėje esantį operandą `alert(1)`. Jis parodo žinutę su `1`.
10+
2. `alert` grąžina `undefined`, tad ARBA eina prie sekančio operando ieškodamas truthy vertės.
11+
3. Antrasis operandas `2` yra truthy, tad operacija sustabdoma, grąžinamas `2` ir parodomas per išorinį alert.
1212

13-
There will be no `3`, because the evaluation does not reach `alert(3)`.
13+
Nebebus `3`, nes įvertinimas nepasiekia `alert(3)`.

1-js/02-first-steps/11-logical-operators/2-alert-or/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 3
22

33
---
44

5-
# What's the result of OR'ed alerts?
5+
# Koks bus ARBA alert rezultatas?
66

7-
What will the code below output?
7+
Ką atiduos žemiau esantis kodas?
88

99
```js
1010
alert( alert(1) || 2 || alert(3) );

1-js/02-first-steps/11-logical-operators/3-alert-1-null-2/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer: `null`, because it's the first falsy value from the list.
1+
Atsakymas: `null`, nes tai yra pirmoji falsy vertė sąraše.
22

33
```js run
44
alert( 1 && null && 2 );

1-js/02-first-steps/11-logical-operators/3-alert-1-null-2/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# What is the result of AND?
5+
# Koks yra IR rezultatas?
66

7-
What is this code going to show?
7+
Ką parodys žemiau esantis kodas?
88

99
```js
1010
alert( 1 && null && 2 );
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
The answer: `1`, and then `undefined`.
1+
Atsakymas: `1`, ir tada `undefined`.
22

33
```js run
44
alert( alert(1) && alert(2) );
55
```
66

7-
The call to `alert` returns `undefined` (it just shows a message, so there's no meaningful return).
7+
Šaukimas `alert` grąžina `undefined` (tiesiog parodo žinutę, tad nebus prasmingo grąžinimo).
88

9-
Because of that, `&&` evaluates the left operand (outputs `1`), and immediately stops, because `undefined` is a falsy value. And `&&` looks for a falsy value and returns it, so it's done.
9+
Dėl to `&&` įvertina kairį operandą (parodo `1`), ir iš karto sustoja, nes `undefined` yra falsy vertė. O `&&` ieško falsy vertės ir ją grąžina, ir sustoja.
1010

1-js/02-first-steps/11-logical-operators/4-alert-and/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 3
22

33
---
44

5-
# What is the result of AND'ed alerts?
5+
# Koks yra IR alerts rezultatas?
66

7-
What will this code show?
7+
Kas parodys kodas esantis žemiau?
88

99
```js
1010
alert( alert(1) && alert(2) );
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
The answer: `3`.
1+
Atsakymas: `3`.
22

33
```js run
44
alert( null || 2 && 3 || 4 );
55
```
66

7-
The precedence of AND `&&` is higher than `||`, so it executes first.
7+
IR `&&` pirmenybė yra aukštesnė už `||`, tad jis įvykdomas pirmiau.
88

9-
The result of `2 && 3 = 3`, so the expression becomes:
9+
Rezultatas yra `2 && 3 = 3`, tad išraiška tampa:
1010

1111
```
1212
null || 3 || 4
1313
```
1414

15-
Now the result is the first truthy value: `3`.
15+
Dabar rezultatas yra pirmoji truthy vertė: `3`.
1616

1-js/02-first-steps/11-logical-operators/5-alert-and-or/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# The result of OR AND OR
5+
# ARBA IR ARBA rezultatas
66

7-
What will the result be?
7+
Koks bus rezultatas?
88

99
```js
1010
alert( null || 2 && 3 || 4 );

1-js/02-first-steps/11-logical-operators/6-check-if-in-range/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ importance: 3
22

33
---
44

5-
# Check the range between
5+
# Patikrinkite intervalą
66

7-
Write an "if" condition to check that `age` is between `14` and `90` inclusively.
7+
Parašykite "if" sąlygą, kuri patikrintų ar `age` yra tarp `14` ir `90` įskaitant.
88

9-
"Inclusively" means that `age` can reach the edges `14` or `90`.
9+
"Įskaitant" reiškia, kad `age` gali pasiekti `14` ir `90` ribas.

1-js/02-first-steps/11-logical-operators/7-check-if-out-range/solution.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
The first variant:
1+
Pirmas variantas:
22

33
```js
44
if (!(age >= 14 && age <= 90))
55
```
66

7-
The second variant:
7+
Antras variantas:
88

99
```js
1010
if (age < 14 || age > 90)

1-js/02-first-steps/11-logical-operators/7-check-if-out-range/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ importance: 3
22

33
---
44

5-
# Check the range outside
5+
# Patikrinkite už intervalo ribų
66

7-
Write an `if` condition to check that `age` is NOT between 14 and 90 inclusively.
7+
Parašykite `if` sąlygą, kuri patikrintų ar `age` nėra tarp 14 ir 90 įskaitant.
88

9-
Create two variants: the first one using NOT `!`, the second one -- without it.
9+
Sukurkite du variantus: vieną naudojant NE `!`, kitą nenaudojant jo.
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
The answer: the first and the third will execute.
1+
Atsakymas: pirma ir antra bus įvykdytos.
22

33
Details:
44

55
```js run
6-
// Runs.
7-
// The result of -1 || 0 = -1, truthy
8-
if (-1 || 0) alert( 'first' );
6+
// Paleidžiama.
7+
// Rezultatas iš -1 || 0 = -1, truthy
8+
if (-1 || 0) alert( 'pirmas' );
99

10-
// Doesn't run
10+
// Nepaleidžiamas
1111
// -1 && 0 = 0, falsy
12-
if (-1 && 0) alert( 'second' );
12+
if (-1 && 0) alert( 'antras' );
1313

14-
// Executes
15-
// Operator && has a higher precedence than ||
16-
// so -1 && 1 executes first, giving us the chain:
14+
// Įvykdomas
15+
// Operatorius && turi aukštesnį prioritetą negu ||
16+
// tad -1 && 1 įvykdomas pirmiau, sukurdamas mums grandinę:
1717
// null || -1 && 1 -> null || 1 -> 1
18-
if (null || -1 && 1) alert( 'third' );
18+
if (null || -1 && 1) alert( 'trečias' );
1919
```
2020

1-js/02-first-steps/11-logical-operators/8-if-question/task.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ importance: 5
22

33
---
44

5-
# A question about "if"
5+
# Klausimas apie "if"
66

7-
Which of these `alert`s are going to execute?
7+
Kurie iš šių `alert`s bus įvykdyti?
88

9-
What will the results of the expressions be inside `if(...)`?
9+
Koks bus išraiškų rezultatas viduje `if(...)`?
1010

1111
```js
12-
if (-1 || 0) alert( 'first' );
13-
if (-1 && 0) alert( 'second' );
14-
if (null || -1 && 1) alert( 'third' );
12+
if (-1 || 0) alert( 'pirmas' );
13+
if (-1 && 0) alert( 'antras' );
14+
if (null || -1 && 1) alert( 'trečias' );
1515
```
1616

Loading
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22

33
```js run demo
4-
let userName = prompt("Who's there?", '');
4+
let userName = prompt("Kas čia?", '');
55

66
if (userName == 'Admin') {
77

8-
let pass = prompt('Password?', '');
8+
let pass = prompt('Slaptažodis?', '');
99

1010
if (pass == 'TheMaster') {
11-
alert( 'Welcome!' );
11+
alert( 'Sveiki!' );
1212
} else if (pass == '' || pass == null) {
13-
alert( 'Canceled' );
13+
alert( 'Atšaukta' );
1414
} else {
15-
alert( 'Wrong password' );
15+
alert( 'Neteisingas slaptažodis' );
1616
}
1717

1818
} else if (userName == '' || userName == null) {
19-
alert( 'Canceled' );
19+
alert( 'Atšaukta' );
2020
} else {
21-
alert( "I don't know you" );
21+
alert( "Aš jūsų nepažįstu" );
2222
}
2323
```
2424

25-
Note the vertical indents inside the `if` blocks. They are technically not required, but make the code more readable.
25+
Atkreipkite dėmesį į vertikalius įgilėjimus viduje `if` rinkinio. Techniškai jie nėra būtini, bet jie paverčia kodą lengviau skaitomu.

0 commit comments

Comments
 (0)