Skip to content

Commit bf2804a

Browse files
authored
Merge pull request #76 from otmon76/1.2.10
Conditional branching: if, '?'
2 parents 4dedfc8 + fa7f719 commit bf2804a

File tree

12 files changed

+151
-151
lines changed

12 files changed

+151
-151
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
**Yes, it will.**
1+
**Ano, zobrazí.**
22

3-
Any string except an empty one (and `"0"` is not empty) becomes `true` in the logical context.
3+
Každý řetězec kromě prázdného (a `"0"` není prázdný řetězec) se v logickém kontextu převede na `true`.
44

5-
We can run and check:
5+
Můžeme si to spustit a uvidíme:
66

77
```js run
88
if ("0") {
9-
alert( 'Hello' );
9+
alert( 'Ahoj' );
1010
}
1111
```
1212

1-js/02-first-steps/10-ifelse/1-if-zero-string/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ importance: 5
22

33
---
44

5-
# if (a string with zero)
5+
# if (řetězec s nulou)
66

7-
Will `alert` be shown?
7+
Zobrazí se `alert`?
88

99
```js
1010
if ("0") {
11-
alert( 'Hello' );
11+
alert( 'Ahoj' );
1212
}
1313
```
1414

Lines changed: 1 addition & 1 deletion
Loading

1-js/02-first-steps/10-ifelse/2-check-standard/ifelse_task2/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<script>
66
'use strict';
77

8-
let value = prompt('What is the "official" name of JavaScript?', '');
8+
let hodnota = prompt('Jaký je „oficiální“ název JavaScriptu?', '');
99

10-
if (value == 'ECMAScript') {
11-
alert('Right!');
10+
if (hodnota == 'ECMAScript') {
11+
alert('Správně!');
1212
} else {
13-
alert("You don't know? ECMAScript!");
13+
alert("Vy to nevíte? ECMAScript!");
1414
}
1515
</script>
1616

1-js/02-first-steps/10-ifelse/2-check-standard/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ importance: 2
22

33
---
44

5-
# The name of JavaScript
5+
# Název JavaScriptu
66

7-
Using the `if..else` construct, write the code which asks: 'What is the "official" name of JavaScript?'
7+
Pomocí konstruktu `if..else` napište kód, který se zeptá: „Jaký je „oficiální“ název JavaScriptu?“
88

9-
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "You don't know? ECMAScript!"
9+
Pokud návštěvník zadá „ECMAScript“, vypište „Správně!“, jinak vypište „Vy to nevíte? ECMAScript!
1010

1111
![](ifelse_task2.svg)
1212

1-js/02-first-steps/10-ifelse/3-sign/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22

33
```js run
4-
let value = prompt('Type a number', 0);
4+
let hodnota = prompt('Zadejte číslo', 0);
55

6-
if (value > 0) {
6+
if (hodnota > 0) {
77
alert( 1 );
8-
} else if (value < 0) {
8+
} else if (hodnota < 0) {
99
alert( -1 );
1010
} else {
1111
alert( 0 );

1-js/02-first-steps/10-ifelse/3-sign/task.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ importance: 2
22

33
---
44

5-
# Show the sign
5+
# Zobrazte znaménko
66

7-
Using `if..else`, write the code which gets a number via `prompt` and then shows in `alert`:
7+
Pomocí `if..else` napište kód, který načte číslo pomocí `prompt` a pak pomocí `alert` zobrazí:
88

9-
- `1`, if the value is greater than zero,
10-
- `-1`, if less than zero,
11-
- `0`, if equals zero.
9+
- `1`, je-li toto číslo větší než nula,
10+
- `-1`, je-li menší než nula,
11+
- `0`, je-li rovno nule.
1212

13-
In this task we assume that the input is always a number.
13+
V tomto cvičení předpokládáme, že vstupem je vždy číslo.
1414

1515
[demo src="if_sign"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

33
```js
4-
let result = (a + b < 4) ? 'Below' : 'Over';
4+
let výsledek = (a + b < 4) ? 'Málo' : 'Moc';
55
```
66

1-js/02-first-steps/10-ifelse/5-rewrite-if-question/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ importance: 5
22

33
---
44

5-
# Rewrite 'if' into '?'
5+
# Přepište „if“ na „?“
66

7-
Rewrite this `if` using the conditional operator `'?'`:
7+
Přepište tento příkaz `if` pomocí podmíněného operátoru `'?'`:
88

99
```js
10-
let result;
10+
let výsledek;
1111

1212
if (a + b < 4) {
13-
result = 'Below';
13+
výsledek = 'Málo';
1414
} else {
15-
result = 'Over';
15+
výsledek = 'Moc';
1616
}
1717
```
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22

33
```js
4-
let message = (login == 'Employee') ? 'Hello' :
5-
(login == 'Director') ? 'Greetings' :
6-
(login == '') ? 'No login' :
4+
let zpráva = (přihlášený == 'Zaměstnanec') ? 'Ahoj' :
5+
(přihlášený == 'Ředitel') ? 'Dobrý den' :
6+
(přihlášený == '') ? 'Nikdo není přihlášený' :
77
'';
88
```
99

0 commit comments

Comments
 (0)