You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/02-structure/article.md
+30-30Lines changed: 30 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,66 +94,66 @@ Amma kod iki ayrı ifadə olmalı idi, tək deyil. Bu halda birləşmə səhv ba
94
94
95
95
Əgər ifadələr sətirlərlə ayrılıbsa, onların arasına nöqtəli vergül qoymağı tövsiyə edirik. Bu qayda JavaScript cəmiyyəti tərəfindən geniş şəkildə qəbul olunub. Yenidən bir də qeyd edək ki, nöqtəli vergülləri çox vaxt buraxmaq -- *mümkündür*. Lakin, xüsusilə yeni başlayanlar üçün, nöqtəli vergüllərdən istifadə etmək daha təhlükəsizdir.
96
96
97
-
## Comments[#code-comments]
97
+
## Şərhlər[#code-comments]
98
98
99
-
As time goes on, programs become more and more complex. It becomes necessary to add *comments* which describe what the code does and why.
99
+
Zaman keçdikcə proqramlar daha mürəkkəb hala gələ bilər. Bu zaman kodun nə etdiyini və niyə olduğunu izah edən *şərhlər* əlavə etmək lazım olur.
100
100
101
-
Comments can be put into any place of a script. They don't affect its execution because the engine simply ignores them.
101
+
Şərhləri skriptin istənilən yerində yerləşdirmək olar. Onlar kodun icrasına təsir etmir, çünki, JavaScript mühərriki onları sadəcə nəzərə almır.
102
102
103
-
**One-line comments start with two forward slash characters `//`.**
103
+
**Təksətirlik şərhlər iki ardıcıl slash (`//`) ilə başlayır.**
104
104
105
-
The rest of the line is a comment. It may occupy a full line of its own or follow a statement.
105
+
Sətirin qalan hissəsi şərh hesab olunur. Şərhlər ayrıca bir sətri tuta bilər və ya bir ifadəni izləyə bilər.
106
106
107
-
Like here:
107
+
Məsələn:
108
108
```js run
109
-
//This comment occupies a line of its own
110
-
alert('Hello');
109
+
//Bu şərh ayrıca bir sətirdə yerləşir
110
+
alert('Salam');
111
111
112
-
alert('World'); //This comment follows the statement
112
+
alert('Dünya'); //Bu şərh ifadədən sonra yerləşir
113
113
```
114
114
115
-
**Multiline comments start with a forward slash and an asterisk <code>/*</code> and end with an asterisk and a forward slash <code>*/</code>.**
115
+
**Çoxsətirli şərhlər bir slash (`/`) və asterisk (`*`) ilə başlayır <code>/*</code> və bir asterisk (`*`) və slash (`/`) ilə bitir <code>*/</code>.**
116
116
117
-
Like this:
117
+
Məsələn:
118
118
119
119
```js run
120
-
/*An example with two messages.
121
-
This is a multiline comment.
120
+
/*İki mesaj ehtiva edən bir nümunə.
121
+
Bu çoxsətirli bir şərhdir.
122
122
*/
123
-
alert('Hello');
124
-
alert('World');
123
+
alert('Salam');
124
+
alert('Dünya');
125
125
```
126
126
127
-
The content of comments is ignored, so if we put code inside <code>/* ... */</code>, it won't execute.
127
+
Şərhlərin məzmunu JavaScript mühərriki tərəfindən nəzərə alınmadığı üçün, əgər kodu <code>/* ... */</code> içərisində yerləşdirsək, o icra olunmayacaq.
128
128
129
-
Sometimes it can be handy to temporarily disable a part of code:
129
+
Bəzən kodun müəyyən bir hissəsini müvəqqəti olaraq söndürmək üçün şərhlərdən istifadə etmək faydalıdır:
130
130
131
131
```js run
132
-
/*Commenting out the code
133
-
alert('Hello');
132
+
/*Kodu deaktiv edirik
133
+
alert('Salam');
134
134
*/
135
-
alert('World');
135
+
alert('Dünya');
136
136
```
137
137
138
-
```smart header="Use hotkeys!"
139
-
In most editors, a line of code can be commented out by pressing the `key:Ctrl+/` hotkey for a single-line comment and something like `key:Ctrl+Shift+/` -- for multiline comments (select a piece of code and press the hotkey). For Mac, try `key:Cmd` instead of `key:Ctrl`.
138
+
```smart header="Qısayollardan istifadə edin!"
139
+
Əksər redaktorlarda bir kod sətrini təksətirlik şərh etmək üçün `key:Ctrl+/` qısayolundan, çoxsətirli şərhlər üçün isə (kodun bir hissəsini seçib) `key:Ctrl+Shift+/` kombinasiyasından istifadə edə bilərsiniz. Mac istifadəçiləri `key:Ctrl` əvəzinə `key:Cmd` istifadə edə bilərlər.
140
140
```
141
141
142
-
````warn header="Nested comments are not supported!"
143
-
There may not be `/*...*/` inside another `/*...*/`.
142
+
````warn header="İç-içə şərhlər dəstəklənmir!"
143
+
`/*...*/` içərisində başqa bir `/*...*/` şərhi yerləşdirilə bilməz.
144
144
145
-
Such code will die with an error:
145
+
Belə bir kod xəta ilə nəticələnir:
146
146
147
147
```js run no-beautify
148
148
/*
149
-
/* nested comment ?!? */
149
+
/* İç-içə şərh ?!? */
150
150
*/
151
-
alert( 'World' );
151
+
alert('Dünya');
152
152
```
153
153
````
154
154
155
-
Please, don't hesitate to comment your code.
155
+
Kodunuzu şərh etməkdən çəkinməyin.
156
156
157
-
Comments increase the overall code footprint, but that's not a problem at all. There are many tools which minify code before publishing to a production server. They remove comments, so they don't appear in the working scripts. Therefore, comments do not have negative effects on production at all.
157
+
Şərhlər ümumi kodun ölçüsünü artırır, lakin bu problem deyil. Bir çox alət kodu "production server"da, yəni istehsal serverində yayımlamadan əvvəl kiçildir. Bu prosesdə şərhlər silinir və işlək skriptlərdə yer almır. Buna görə də şərhlərin istehsal serverinə heç bir mənfi təsiri yoxdur.
158
158
159
-
Later in the tutorial there will be a chapter <info:code-quality>that also explains how to write better comments.
159
+
Daha sonra bu dərslikdə <info:code-quality>adlı bir fəsil olacaq. Bu fəsil daha yaxşı şərhlər yazmaq barədə əlavə məsləhətlər verəcək.
0 commit comments