-
-
Notifications
You must be signed in to change notification settings - Fork 3
Basic operators, maths #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
239be5b
1.2.8
otmon76 08106cb
Update 1-js/02-first-steps/08-operators/1-increment-order/solution.md
otmon76 81d715a
Update 1-js/02-first-steps/08-operators/1-increment-order/solution.md
otmon76 abf3900
Update 1-js/02-first-steps/08-operators/1-increment-order/task.md
otmon76 2571325
Update 1-js/02-first-steps/08-operators/article.md
otmon76 5b7a89b
Update 1-js/02-first-steps/08-operators/article.md
otmon76 eb3dc1b
Update 1-js/02-first-steps/08-operators/article.md
otmon76 53ff266
Update 1-js/02-first-steps/08-operators/article.md
otmon76 58f4a25
Update 1-js/02-first-steps/08-operators/article.md
otmon76 ef0ce09
Update 1-js/02-first-steps/08-operators/article.md
otmon76 4dde2aa
Update 1-js/02-first-steps/08-operators/article.md
otmon76 73d05c6
Update 1-js/02-first-steps/08-operators/article.md
otmon76 5a7d24a
Update 1-js/02-first-steps/08-operators/article.md
otmon76 477e8de
Update 1-js/02-first-steps/08-operators/article.md
otmon76 cdf1bbf
Update 1-js/02-first-steps/08-operators/article.md
otmon76 459de01
Update 1-js/02-first-steps/08-operators/article.md
otmon76 3fcabd4
Update 1-js/02-first-steps/08-operators/article.md
otmon76 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
1-js/02-first-steps/08-operators/2-assignment-result/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
The answer is: | ||
Odpověď zní: | ||
|
||
- `a = 4` (multiplied by 2) | ||
- `x = 5` (calculated as 1 + 4) | ||
- `a = 4` (vynásobí se 2) | ||
- `x = 5` (vypočítá se jako 1 + 4) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions
24
1-js/02-first-steps/08-operators/4-fix-prompt/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
The reason is that prompt returns user input as a string. | ||
Důvodem je, že funkce `prompt` vrací uživatelský vstup jako řetězec. | ||
|
||
So variables have values `"1"` and `"2"` respectively. | ||
V proměnných jsou tedy hodnoty po řadě `"1"` a `"2"`. | ||
|
||
```js run | ||
let a = "1"; // prompt("First number?", 1); | ||
let b = "2"; // prompt("Second number?", 2); | ||
let a = "1"; // prompt("První číslo?", 1); | ||
let b = "2"; // prompt("Druhé číslo?", 2); | ||
|
||
alert(a + b); // 12 | ||
``` | ||
|
||
What we should do is to convert strings to numbers before `+`. For example, using `Number()` or prepending them with `+`. | ||
To, co bychom měli udělat, je před sečtením převést řetězce na čísla. Například použít `Number()` nebo před ně uvést `+`. | ||
|
||
For example, right before `prompt`: | ||
Například rovnou před `prompt`: | ||
|
||
```js run | ||
let a = +prompt("First number?", 1); | ||
let b = +prompt("Second number?", 2); | ||
let a = +prompt("První číslo?", 1); | ||
let b = +prompt("Druhé číslo?", 2); | ||
|
||
alert(a + b); // 3 | ||
``` | ||
|
||
Or in the `alert`: | ||
Nebo až při volání `alert`: | ||
|
||
```js run | ||
let a = prompt("First number?", 1); | ||
let b = prompt("Second number?", 2); | ||
let a = prompt("První číslo?", 1); | ||
let b = prompt("Druhé číslo?", 2); | ||
|
||
alert(+a + +b); // 3 | ||
``` | ||
|
||
Using both unary and binary `+` in the latest code. Looks funny, doesn't it? | ||
V posledním kódu používáme současně unární i binární `+`. Vypadá to legračně, že? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.