-
Notifications
You must be signed in to change notification settings - Fork 30
Variables #11
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
Closed
Closed
Variables #11
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
8 changes: 4 additions & 4 deletions
8
1-js/02-first-steps/04-variables/1-hello-variables/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,12 +1,12 @@ | ||
In the code below, each line corresponds to the item in the task list. | ||
W kodzie poniżej, każda linia odpowiada podpunktowi w liście zadań. | ||
|
||
```js run | ||
let admin, name; // can declare two variables at once | ||
let admin, name; // można zadeklarować dwie zmienne naraz | ||
|
||
name = "John"; | ||
name = "Jan"; | ||
|
||
admin = name; | ||
|
||
alert( admin ); // "John" | ||
alert( admin ); // "Jan" | ||
``` | ||
|
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
18 changes: 9 additions & 9 deletions
18
1-js/02-first-steps/04-variables/2-declare-variables/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,21 +1,21 @@ | ||
First, the variable for the name of our planet. | ||
Najpierw zmienna dla nazwy naszej planety. | ||
|
||
That's simple: | ||
To proste: | ||
|
||
```js | ||
let ourPlanetName = "Earth"; | ||
let ourPlanetName = "Ziemia"; | ||
``` | ||
|
||
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. | ||
Zauważ, że mogliśmy użyć krótszej nazwy `planet`, ale nie jest oczywiste do jakiej planety się odnosimy. Dobrze jest być konkretnym. Przynajmniej dopóki nazwa nie jest za długa. | ||
|
||
Second, the name of the current visitor: | ||
Teraz nazwa obecnego odwiedzającego: | ||
|
||
```js | ||
let currentUserName = "John"; | ||
let currentUserName = "Jan"; | ||
``` | ||
|
||
Again, we could shorten that to `userName` if we know for sure that the user is current. | ||
Znowu mogliśmy skrócić nazwę do `userName` jeśli jesteśmy pewni, że dany użytkownik jest użytkownikiem bieżącym. | ||
|
||
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. | ||
Współczesne edytory i autouzupełnianie sprawiają, ułatwiają pisanie długich nazw zmiennych. Nie oszczędzaj na nich. Nazwa składająca się z 3 wyrazów jest w porządku. | ||
effhAVE marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
And if your editor does not have proper autocompletion, get [a new one](/code-editors). | ||
A jeśli Twój edytor nie ma odpowiedniego autouzupełniania, [spraw sobie nowy](/code-editors). | ||
effhAVE marked this conversation as resolved.
Show resolved
Hide resolved
|
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/04-variables/3-uppercast-constant/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 @@ | ||
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. | ||
Zazwyczaj używamy wielkich liter dla stałych, które są "zakodowane na stałe". Lub, innymi słowy, gdy wartość jest znana przed wykonaniem i bezpośrednio zapisana w kodzie. | ||
|
||
In this code, `birthday` is exactly like that. So we could use the upper case for it. | ||
W tym kodzie `birthday` jest dokładnie takim przypadkiem. Możemy więc użyć wielkich liter. | ||
|
||
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. | ||
W przeciwieństwie do tego, `age` jest obliczane w czasie wykonywania. Dzisiaj mamy jeden wiek a za rok będziemy mieli kolejny. Jest to stała w tym sensie, że nie zmienia się w trakcie wykonanie kodu, ale jest trochę "mniej stała" niż `birthday`. Jest to wartość obliczana, więc powinniśmy pozostać przy małych literach. |
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.