-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from JoeGab/master
Variables
- Loading branch information
Showing
7 changed files
with
141 additions
and
140 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
1-js/02-first-steps/04-variables/1-hello-variables/solution.md
This file contains 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 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
15 changes: 8 additions & 7 deletions
15
1-js/02-first-steps/04-variables/2-declare-variables/solution.md
This file contains 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,21 +1,22 @@ | ||
## The variable for our planet | ||
## Die Variable für unseren Planeten | ||
|
||
That's simple: | ||
Das ist einfach: | ||
|
||
```js | ||
let ourPlanetName = "Earth"; | ||
``` | ||
|
||
Note, we could use a shorter name `planet`, but it might be not obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong. | ||
Beachte, wir könnten einen kürzeren Namen `planet` verwenden, aber es könnte nicht offensichtlich sein, auf welchen Planeten er sich bezieht. Es ist schön, etwas ausführlicher zu sein. Zumindest bis die Variable nicht zu lang ist. | ||
|
||
## The name of the current visitor | ||
## Der Name des aktuellen Besuchers | ||
|
||
```js | ||
let currentUserName = "John"; | ||
``` | ||
|
||
Again, we could shorten that to `userName` if we know for sure that the user is current. | ||
Auch hier könnten wir das auf `userName` kürzen, wenn wir sicher wissen, dass der Benutzer aktuell ist. | ||
|
||
Modern editors and autocomplete make long variable names easy to write. Don't save on them. A name with 3 words in it is fine. | ||
Moderne Editoren und Autovervollständigung machen lange Variablennamen einfach zu schreiben. Spare nicht daran. Ein Name mit 3 Wörtern darin ist in Ordnung. | ||
|
||
Und wenn dein Editor nicht über die anständige Autovervollständigung verfügt, hol dir [einen neuen](/code-editors). | ||
|
||
And if your editor does not have proper autocompletion, get [a new one](/code-editors). |
This file contains 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/04-variables/3-uppercast-constant/solution.md
This file contains 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 @@ | ||
We generally use upper case for constants that are "hard-coded". Or, in other words, when the value is known prior to execution and directly written into the code. | ||
Für Konstanten, die "hart-codiert" sind, verwenden wir in der Regel Großbuchstaben. Oder, mit anderen Worten, wenn der Wert vor der Ausführung bekannt ist und direkt in den Code geschrieben wird. | ||
|
||
In this code, `birthday` is exactly like that. So we could use the upper case for it. | ||
In diesem Code ist der Geburtstag `birthday` genau so. Wir können also Großbuchstaben dafür verwenden. | ||
|
||
In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`: it is calculated, so we should keep the lower case for it. | ||
Im Gegensatz dazu wird das Alter `age` zur Laufzeit ausgewertet. Heute haben wir ein Alter, ein Jahr später ein anderes. Es ist in gewissem Sinne konstant, dass es sich durch die Codeausführung nicht ändert. Aber es ist ein bisschen "weniger konstant" als der Geburtstag `birthday`: es wird berechnet, also sollten wir die Kleinschreibung dafür beibehalten. |
This file contains 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.