Skip to content

Translate Variables page #7

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 8 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Aşağıdakı kodda olan hər sətir tapşırıqda olan hər maddəyə aiddir.

```js run
let admin, name; // can declare two variables at once
let admin, name; // bir dəfəyə iki dəyişən elan etmək mümkündür

name = "John";
name = "Orxan";

admin = name;

alert( admin ); // "John"
alert( admin ); // "Orxan"
```

10 changes: 5 additions & 5 deletions 1-js/02-first-steps/04-variables/1-hello-variables/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 2

---

# Working with variables
# Dəyişənlər ilə işləmək

1. Declare two variables: `admin` and `name`.
2. Assign the value `"John"` to `name`.
3. Copy the value from `name` to `admin`.
4. Show the value of `admin` using `alert` (must output "John").
1. İki dəyişən elan edin: `admin` `name`.
2. `name` dəyişəninə `"Orxan"` dəyərini təyin edin.
3. `name` dəyişənindən `admin` dəyişəninə dəyəri kopyalayın.
4. `admin` dəyişəninin dəyərini `alert` istifadə edərək göstərin (nəticə "Orxan" olmalıdır).
18 changes: 9 additions & 9 deletions 1-js/02-first-steps/04-variables/2-declare-variables/solution.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## The variable for our planet
## Bizim planet üçün dəyişən

That's simple:
Bu sadədir:

```js
let ourPlanetName = "Earth";
let ourPlanetName = "Yer";
```

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.
Qeyd edək ki, daha qısa `planet` adı istifadə edə bilərdik, amma onun hansı planetə aid olduğu aydın olmaya bilər. Daha izahlı olmaq yaxşıdır. Ən azı dəyişən çox uzun olmadığı müddətcə.

## The name of the current visitor
## Cari ziyarətçinin adı

```js
let currentUserName = "John";
let currentUserName = "Orxan";
```

Again, we could shorten that to `userName` if we know for sure that the user is current.
Yenə də, əgər istifadəçinin cari olduğunu dəqiq bilsək, bunu `userName` kimi qısalda bilərik.

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.
Müasir redaktorlar və avtomatik tamamlanma xüsusiyyəti uzun dəyişən adlarını yazmağı asanlaşdırır. Onlardan qənaət etməyin. Üç sözlük bir ad tamamilə qəbul ediləndir.

And if your editor does not have proper autocompletion, get [a new one](/code-editors).
Əgər redaktorunuzda avtomatik tamamlama xüsusiyyəti yoxdursa, [yeni redaktor əldə edin](/code-editors).
6 changes: 3 additions & 3 deletions 1-js/02-first-steps/04-variables/2-declare-variables/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ importance: 3

---

# Giving the right name
# Düzgün adın verilməsi

1. Create a variable with the name of our planet. How would you name such a variable?
2. Create a variable to store the name of a current visitor to a website. How would you name that variable?
1. Bizim planetimiz adında dəyişən yaradın. Bu dəyişəni necə adlandırardınız?
2. Veb səhifəyə daxil olan cari ziyarətçinin adını dəyişəndə saxlayın. Bu dəyişəni necə adlandırardınız?
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.
Normalda, biz əl ilə yazılan sabit dəyişənləri böyük hərf ilə yazırıq. Digər sözlə dəyişənin dəyəri skriptin icrasından öncə bilindikdə və kodda birbaşa yazıldıqda biz bu dəyişəni böyük hərflərlə yazırıq.

In this code, `birthday` is exactly like that. So we could use the upper case for it.
Bu kodda `birthday` məhz belədir. Ona görə də onun üçün böyük hərflərdən istifadə edə bilərik.

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.
Lakin `age` dəyişəni icra zamanı hesablanır. Bu gün bizdə fərqli bir yaş, bir il sonra isə fərqli bir yaş olacaq. Bu dəyişən kod icrası zamanı dəyişmir amma bu dəyişən hesablanır deyə `birthday`-dən "daha az sabitdir". Bu səbəbdən, bu dəyişənin adı böyük hərflərlə yazılmamalıdır.
12 changes: 6 additions & 6 deletions 1-js/02-first-steps/04-variables/3-uppercast-constant/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ importance: 4

---

# Uppercase const?
# Böyük hərflərlə const?

Examine the following code:
Aşağıdakı koda baxın:

```js
const birthday = '18.04.1982';

const age = someCode(birthday);
```

Here we have a constant `birthday` date and the `age` is calculated from `birthday` with the help of some code (it is not provided for shortness, and because details don't matter here).
Burada `birthday` olaraq adlandırılmış bir tarix dəyəri saxlayan konstantımız var. `age` həmin `birthday` və müəyyən bir kodun köməyi ilə hesablanır (qısa olsun deyə və təfərrüatlar burada əhəmiyyətli olmadığı üçün bu kod təmin edilməyib).

Would it be right to use upper case for `birthday`? For `age`? Or even for both?
`birthday` üçün böyük hərflərdən istifadə etmək yaxşı fikirdir?

```js
const BIRTHDAY = '18.04.1982'; // make uppercase?
const BIRTHDAY = '18.04.1982'; // böyük hərflərlə yazaq?

const AGE = someCode(BIRTHDAY); // make uppercase?
const AGE = someCode(BIRTHDAY); // böyük hərflərlə yazaq?
```

Loading