From e59a90bdca17c47c6e4691fbdffc5128bdd0f84e Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Wed, 15 Jan 2025 13:02:06 +0400 Subject: [PATCH 01/13] WIP --- 1-js/02-first-steps/05-types/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index cce9267db..96e37ab78 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -1,4 +1,4 @@ -# Data types +# Verilən tipləri A variable in JavaScript can contain any data. A variable can at one moment be a string and at another be a number: From a0a78725d0f2c41988fa34379ed515f362bf5f10 Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Wed, 15 Jan 2025 13:25:12 +0400 Subject: [PATCH 02/13] 1.2.5. Article - Data Types --- 1-js/02-first-steps/05-types/article.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 96e37ab78..ecde2fa55 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -1,16 +1,16 @@ # Verilən tipləri -A variable in JavaScript can contain any data. A variable can at one moment be a string and at another be a number: +JavaScript-də bir dəyişən istənilən veriləni ehtiva edə bilər. Bir dəyişən əvvəl `string` tipində ola bilər, sonra isə `number` tipinə çevrilə bilər. ```js -// no error -let message = "hello"; +// xəta yoxdur +let message = "salam"; message = 123456; ``` -Programming languages that allow such things are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them. +Bu cür hallara icazə verən proqramlaşdırma dillərinə "dinamik tipli dillər" deyilir. Bu o deməkdir ki, verilən tipləri mövcuddur, lakin dəyişənlər həmin tiplərə bağlı deyil. -There are eight basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail. +JavaScript-də 8 əsas verilən tipi mövcuddur. Bu fəsildə onları ümumi olaraq nəzərdən keçirəcəyik, növbəti fəsillərdə isə hər biri haqqında daha ətraflı danışacağıq. ## Number From 2e3a60ecc7aa97d8f0d2c1294b857ded24bba285 Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Wed, 15 Jan 2025 13:53:14 +0400 Subject: [PATCH 03/13] 1.2.5. Article - Number --- 1-js/02-first-steps/05-types/article.md | 35 +++++++++++++------------ 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index ecde2fa55..9b84837e1 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -12,55 +12,56 @@ Bu cür hallara icazə verən proqramlaşdırma dillərinə "dinamik tipli dill JavaScript-də 8 əsas verilən tipi mövcuddur. Bu fəsildə onları ümumi olaraq nəzərdən keçirəcəyik, növbəti fəsillərdə isə hər biri haqqında daha ətraflı danışacağıq. -## Number +## Rəqəm ```js let n = 123; n = 12.345; ``` -The *number* type represents both integer and floating point numbers. +*Number* tipi həm tam ədədləri, həm də onluq kəsirli ədədləri təmsil edir. -There are many operations for numbers, e.g. multiplication `*`, division `/`, addition `+`, subtraction `-`, and so on. +Rəqəmlər üçün vurma (`*`), bölmə (`/`), toplama (`+`), çıxma (`-`) və s. kimi bir çox əməliyyat mövcuddur. -Besides regular numbers, there are so-called "special numeric values" which also belong to this data type: `Infinity`, `-Infinity` and `NaN`. +Adi ədədlərlə yanaşı, bu verilən tipinə aid olan "xüsusi ədədi dəyərlər" də var: `Infinity`, `-Infinity` və `NaN`. -- `Infinity` represents the mathematical [Infinity](https://en.wikipedia.org/wiki/Infinity) ∞. It is a special value that's greater than any number. +- `Infinity` riyaziyyatdakı [sonsuzluğu](https://en.wikipedia.org/wiki/Infinity) (`∞`) ifadə edir. Bu, xüsusi bir dəyərdir və hər hansı bir ədəddən böyükdür. - We can get it as a result of division by zero: + Biz onu bir ədədi sıfıra bölməklə əldə edə bilərik: ```js run alert( 1 / 0 ); // Infinity ``` - Or just reference it directly: + Və ya birbaşa ona müraciət edə bilərik: ```js run alert( Infinity ); // Infinity ``` -- `NaN` represents a computational error. It is a result of an incorrect or an undefined mathematical operation, for instance: + +- `NaN` hesablama xətasını ifadə edir. Bu, səhv və ya qeyri-müəyyən bir riyazi əməliyyatın nəticəsidir. Məsələn: ```js run - alert( "not a number" / 2 ); // NaN, such division is erroneous + alert( "rəqəm deyil" / 2 ); // NaN, bu cür əməliyyat yanlışdır ``` - `NaN` is sticky. Any further operation on `NaN` returns `NaN`: + `NaN` "yapışqan" kimidir. Üzərində aparılan hər hansı bir əməliyyat yenə `NaN` qaytarır: ```js run - alert( "not a number" / 2 + 5 ); // NaN + alert( "rəqəm deyil" / 2 + 5 ); // NaN ``` - So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result. + Yəni, əgər bir riyazi ifadədə `NaN` varsa, bu, nəticənin hamısına təsir edir. -```smart header="Mathematical operations are safe" -Doing maths is "safe" in JavaScript. We can do anything: divide by zero, treat non-numeric strings as numbers, etc. +```smart header="Riyazi əməliyyatlar təhlükəsizdir" +JavaScript-də riyazi əməliyyatlar "təhlükəsizdir". 0-a bölmə, ədədi olmayan sətirləri rəqəm kimi istifadə etmək və s. edə bilərik. -The script will never stop with a fatal error ("die"). At worst, we'll get `NaN` as the result. +Ssenari heç vaxt ölümcül bir xəta ("fatal error") ilə sonlanmaz. Ən pis halda, nəticə olaraq `NaN` alarıq. ``` -Special numeric values formally belong to the "number" type. Of course they are not numbers in the common sense of this word. +Xüsusi ədədi dəyərlər formal olaraq "rəqəm" (`number`) tipinə aiddir. Amma bu, onların həmişə adi ədədlər olduğu anlamına gəlmir. -We'll see more about working with numbers in the chapter . +Biz fəslində rəqəmlərlə işləməyi daha ətraflı öyrənəcəyik. ## BigInt From 95c34ad1cdca0963792cc5db1dcc4cf6fb5a6128 Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Wed, 15 Jan 2025 14:07:06 +0400 Subject: [PATCH 04/13] 1.2.5. Article - BigInt --- 1-js/02-first-steps/05-types/article.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 9b84837e1..ddcbe3b7e 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -65,21 +65,21 @@ Biz fəslində rəqəmlərlə işləməyi daha ətraflı öyrənə ## BigInt -In JavaScript, the "number" type cannot represent integer values larger than 253 (or less than -253 for negatives), that's a technical limitation caused by their internal representation. That's about 16 decimal digits, so for most purposes the limitation isn't a problem, but sometimes we need really big numbers, e.g. for cryptography or microsecond-precision timestamps. +JavaScript-də "rəqəm" (`number`) tipi 253-dən böyük (və ya -253-dən kiçik) tam ədədləri ifadə edə bilmir. Bu, onların daxili təqdimatındakı texniki məhdudiyyətdir. Bu, təxminən 16 onluq rəqəmə bərabərdir və əksər hallarda bu məhdudiyyət problem yaratmır. Lakin bəzən, məsələn, kriptoqrafiya və ya mikro-saniyə dəqiqliyi ilə vaxt ölçmələri üçün çox böyük ədədlərə ehtiyac duyula bilər. -`BigInt` type was recently added to the language to represent integers of arbitrary length. +Dilə yaxın zamanda əlavə edilmiş `BigInt` tipi istənilən uzunluqda tam ədədləri təmsil etmək üçün istifadə olunur. -A `BigInt` is created by appending `n` to the end of an integer literal: +`BigInt` yaratmaq üçün tam ədədin sonuna `n` əlavə olunur: ```js -// the "n" at the end means it's a BigInt +// sondakı "n" onun bir `BigInt` olduğunu bildirir const bigInt = 1234567890123456789012345678901234567890n; ``` -As `BigInt` numbers are rarely needed, we devoted them a separate chapter . +`BigInt` rəqəmlərə nadir hallarda ehtiyac duyulduğundan, bu mövzuya xüsusi bir fəsil () həsr etmişik. -```smart header="Compatability issues" -Right now `BigInt` is supported in Firefox and Chrome, but not in Safari/IE/Edge. +```smart header="Uyğunluq problemləri" +Hal-hazırda `BigInt` Firefox və Chrome-da dəstəklənir, lakin Safari, IE və Edge-də dəstəklənmir. ``` ## String From 9242bc1c7bf4d63c90a4d99d9c0247bc286db25a Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sat, 18 Jan 2025 19:42:52 +0400 Subject: [PATCH 05/13] 1.2.5. Article - String --- 1-js/02-first-steps/05-types/article.md | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index ddcbe3b7e..4b94bba23 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -84,47 +84,47 @@ Hal-hazırda `BigInt` Firefox və Chrome-da dəstəklənir, lakin Safari, IE və ## String -A string in JavaScript must be surrounded by quotes. +JavaScript-də bir [`string`](https://en.wikipedia.org/wiki/String_(computer_science)) mütləq dırnaqlar ilə əhatə olunmalıdır. ```js -let str = "Hello"; -let str2 = 'Single quotes are ok too'; -let phrase = `can embed another ${str}`; +let str = "Salam"; +let str2 = 'Tək dırnaqlar da uyğundur'; +let phrase = `başqa bir ${str} ehtiva edə bilər`; ``` -In JavaScript, there are 3 types of quotes. +JavaScript-də `string`-i ifadə etməyin 3 yolu mövcuddur. -1. Double quotes: `"Hello"`. -2. Single quotes: `'Hello'`. -3. Backticks: `Hello`. +1. Cüt dırnaq: `"Hello"`. +2. Tək dırnaq: `'Hello'`. +3. Tərs dırnaq: `Salam`. -Double and single quotes are "simple" quotes. There's practically no difference between them in JavaScript. +Cüt dırnaq və tək dırnaqlar "sadə" dırnaqlar adlanır. JavaScript-də onların arasında demək olar ki, heç bir fərq yoxdur. -Backticks are "extended functionality" quotes. They allow us to embed variables and expressions into a string by wrapping them in `${…}`, for example: +Tərs dırnaqlar "genişləndirilmiş funksionallıq" təklif edən dırnaqlardır. Onlar bizə dəyişənləri və ifadələri `${...}` arasına alaraq bir `string`-ə daxil etməyə imkan verir, məsələn: ```js run -let name = "John"; +let name = "Eldar"; -// embed a variable -alert( `Hello, *!*${name}*/!*!` ); // Hello, John! +// bir dəyişən daxil edin +alert( `Salam, *!*${name}*/!*!` ); // Salam, Eldar! -// embed an expression -alert( `the result is *!*${1 + 2}*/!*` ); // the result is 3 +// bir ifadə daxil edin +alert( `nəticə: *!*${1 + 2}*/!*` ); // nəticə: 3 ``` -The expression inside `${…}` is evaluated and the result becomes a part of the string. We can put anything in there: a variable like `name` or an arithmetical expression like `1 + 2` or something more complex. +`${...}` arasındakı ifadə JavaScript mühərriki tərəfindən dəyərləndirilir və nəticə `string`-in bir hissəsinə çevrilir. Biz burada istənilən şeyi yaza bilərik: məsələn, `name` adlı bir dəyişən, `1 + 2` kimi riyazi bir ifadə və ya daha kompleks bir şey. -Please note that this can only be done in backticks. Other quotes don't have this embedding functionality! +Qeyd edək ki, bu yanlız tərs dırnaqlar (backtricks: ``) üçün keçərlidir. Digər dırnaqlarda bu funksionallıq mövcud deyil. ```js run -alert( "the result is ${1 + 2}" ); // the result is ${1 + 2} (double quotes do nothing) +alert( "nəticə: ${1 + 2}" ); // nəticə: ${1 + 2} (cüt dırnaqlar heç nə etmir) ``` -We'll cover strings more thoroughly in the chapter . +Biz `string`-ləri fəslində daha ətraflı izah edəcəyik. -```smart header="There is no *character* type." -In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is called "char". +```smart header="*character* tipi mövcud deyil." +Bəzi proqramlaşdırma dillərində yalnız bir simvolu saxlamaq üçün xüsusi bir verilənlər tipi mövcuddur. Məsələn, C və Java dillərində bu tip "char" adlanır. -In JavaScript, there is no such type. There's only one type: `string`. A string may consist of only one character or many of them. +JavaScript-də belə bir tip yoxdur. Yalnız bir verilən tipi var: `string`. Bir `string` bir və ya daha çox simvoldan ibarət ola bilər. ``` ## Boolean (logical type) From 259e09b2a70f304bc818fee521d9906ccb87b32e Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 21:49:04 +0400 Subject: [PATCH 06/13] 1.2.5. Article - Boolean --- 1-js/02-first-steps/05-types/article.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 4b94bba23..eb1f6bcda 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -127,28 +127,28 @@ Bəzi proqramlaşdırma dillərində yalnız bir simvolu saxlamaq üçün xüsus JavaScript-də belə bir tip yoxdur. Yalnız bir verilən tipi var: `string`. Bir `string` bir və ya daha çox simvoldan ibarət ola bilər. ``` -## Boolean (logical type) +## Boolean (məntiqi tip) -The boolean type has only two values: `true` and `false`. +`boolean` tipi sadəcə 2 mümkün dəyərə sahibdir: `true` və `false`. -This type is commonly used to store yes/no values: `true` means "yes, correct", and `false` means "no, incorrect". +Bu tip ümumi olaraq hə/yox dəyərlərini saxlamaq üçün istifadə olunur: `true`, "bəli, doğrudur", `false` "xeyr, yanlışdır" mənasına gəlir. -For instance: +Məsələn: ```js -let nameFieldChecked = true; // yes, name field is checked -let ageFieldChecked = false; // no, age field is not checked +let nameFieldChecked = true; // bəli, ad sahəsi yoxlandı +let ageFieldChecked = false; // xeyr, yaş sahəsi yoxlanmadı ``` -Boolean values also come as a result of comparisons: +`boolean` tipi həm də nəticələrin müqayisəsində istifadə edilir: ```js run let isGreater = 4 > 1; -alert( isGreater ); // true (the comparison result is "yes") +alert( isGreater ); // true (müqayisənin nəticəsi "doğru"dur) ``` -We'll cover booleans more deeply in the chapter . +Biz `boolean` tipini fəslində daha dərindən izah edəcəyik. ## The "null" value From c26799063d17e9a609d450a92f2409bb2b196384 Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 21:58:21 +0400 Subject: [PATCH 07/13] 1.2.5. Article - Null --- 1-js/02-first-steps/05-types/article.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index eb1f6bcda..9f2a2a24d 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -150,21 +150,21 @@ alert( isGreater ); // true (müqayisənin nəticəsi "doğru"dur) Biz `boolean` tipini fəslində daha dərindən izah edəcəyik. -## The "null" value +## "null" dəyəri -The special `null` value does not belong to any of the types described above. +Xüsusi bir dəyər olan `null`, yuxarıda təsvir edilən tiplərdən heç birinə aid deyil. -It forms a separate type of its own which contains only the `null` value: +Bu dəyər yalnız özünə məxsus ayrıca bir tipdir və bu tip sadəcə `null` dəyərindən ibarətdir. ```js let age = null; ``` -In JavaScript, `null` is not a "reference to a non-existing object" or a "null pointer" like in some other languages. +JavaScript-də `null`, "mövcud olmayan bir obyektə referans" və ya digər dillərdə olduğu kimi "null göstərici (null pointer)" anlamına gəlmir. -It's just a special value which represents "nothing", "empty" or "value unknown". +Bu sadəcə xüsusi bir dəyərdir və "heç nə", "boş" və ya "bilinməyən dəyər"i ifadə edir. -The code above states that `age` is unknown or empty for some reason. +Yuxarıdakı kod, `age` dəyişənin dəyərinin nə üçünsə bilinməyən və ya boş olduğunu bildirir. ## The "undefined" value From c3509e2c4ed434c4dc0d39f233d1556c7e7b8219 Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 22:11:06 +0400 Subject: [PATCH 08/13] 1.2.5. Article - Undefined --- 1-js/02-first-steps/05-types/article.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 9f2a2a24d..6ac04a036 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -166,21 +166,21 @@ Bu sadəcə xüsusi bir dəyərdir və "heç nə", "boş" və ya "bilinməyən d Yuxarıdakı kod, `age` dəyişənin dəyərinin nə üçünsə bilinməyən və ya boş olduğunu bildirir. -## The "undefined" value +## "undefined" dəyəri -The special value `undefined` also stands apart. It makes a type of its own, just like `null`. +Xüsusi bir dəyər olan `undefined` da ayrıca bir mövqeyə malikdir. Bu, özünəməxsus bir tip meydana gətirir. -The meaning of `undefined` is "value is not assigned". +`undefined` dəyəri, "dəyər təyin edilməyib" anlamına gəlir. -If a variable is declared, but not assigned, then its value is `undefined`: +Əgər bir dəyişən elan olunubsa, lakin onun üçün heç bir dəyər təyin edilməyibsə, onun dəyəri `undefined` olacaq: ```js run let x; -alert(x); // shows "undefined" +alert(x); // "undefined" göstərir ``` -Technically, it is possible to assign `undefined` to any variable: +Texniki olaraq, `undefined` istənilən dəyişənə mənimsədilə bilər: ```js run let x = 123; @@ -190,7 +190,7 @@ x = undefined; alert(x); // "undefined" ``` -...But we don't recommend doing that. Normally, we use `null` to assign an "empty" or "unknown" value to a variable, and we use `undefined` for checks like seeing if a variable has been assigned. +... Amma biz bunu etməyi tövsiyə etmirik. Normalda "boş" və ya "bilinməyən" bir dəyəri ifadə etmək üçün `null` istifadə olunur. `undefined` isə əsasən dəyişənin dəyərinin mənimsədildiyini yoxlamaq üçün istifadə edilir. ## Objects and Symbols From e672a5a6193d5f286cc891e8484e55b773b4f06e Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 22:20:43 +0400 Subject: [PATCH 09/13] 1.2.5. Article - Objects and Symbols --- 1-js/02-first-steps/05-types/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 6ac04a036..f169f8c2c 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -192,13 +192,13 @@ alert(x); // "undefined" ... Amma biz bunu etməyi tövsiyə etmirik. Normalda "boş" və ya "bilinməyən" bir dəyəri ifadə etmək üçün `null` istifadə olunur. `undefined` isə əsasən dəyişənin dəyərinin mənimsədildiyini yoxlamaq üçün istifadə edilir. -## Objects and Symbols +## Obyektlər (Objects) və Simvollar (Symbols) -The `object` type is special. +`object` xüsusi bir tipdir. -All other types are called "primitive" because their values can contain only a single thing (be it a string or a number or whatever). In contrast, objects are used to store collections of data and more complex entities. We'll deal with them later in the chapter after we learn more about primitives. +Bütün digər tiplər "primitiv (primitive)" tip adlanır, çünki, onların dəyərləri yalnız bir şey (məsələn, bir `string`, `number` və ya başqa bir şey) ehtiva edə bilər. Bunun əksinə olaraq, obyektlər verilən kolleksiyalarını və daha mürəkkəb quruluşları saxlamaq üçün istifadə olunur. Primitiv tipləri daha yaxşı öyrəndikdən sonra obyektlər mövzusuna fəslində toxunacağıq. -The `symbol` type is used to create unique identifiers for objects. We mention it here for completeness, but we'll study it after objects. +`symbol` tipi obyektlər üçün unikal identifikatorlar yaratmaqda istifadə olunur. Onu burada tamlıq üçün qeyd edirik, lakin obyektləri öyrəndikdən sonra bu mövzuya qayıdacağıq. ## The typeof operator [#type-typeof] From 3b490e8a5e9b9f5aa126c741df403fe9ac7e74da Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 23:01:11 +0400 Subject: [PATCH 10/13] 1.2.5. Article - typeof operator --- 1-js/02-first-steps/05-types/article.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index f169f8c2c..702ec92b7 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -200,18 +200,18 @@ Bütün digər tiplər "primitiv (primitive)" tip adlanır, çünki, onların d `symbol` tipi obyektlər üçün unikal identifikatorlar yaratmaqda istifadə olunur. Onu burada tamlıq üçün qeyd edirik, lakin obyektləri öyrəndikdən sonra bu mövzuya qayıdacağıq. -## The typeof operator [#type-typeof] +### `typeof` operatoru [#type-typeof] -The `typeof` operator returns the type of the argument. It's useful when we want to process values of different types differently or just want to do a quick check. +`typeof` operatoru arqumentin tipini qaytarır. Fərqli tipləri müxtəlif üsullarla işləmək lazım olduqda və ya sadəcə sürətli bir yoxlama aparmaq istədikdə çox faydalıdır. -It supports two forms of syntax: +Bu operator iki sintaksisi dəstəkləyir: -1. As an operator: `typeof x`. -2. As a function: `typeof(x)`. +1. Operator kimi: `typeof x`. +2. Funksiya kimi: `typeof(x)`. -In other words, it works with parentheses or without them. The result is the same. +Başqa sözlə, mötərizələrlə və ya mötərizəsiz istifadə edilə bilər. Hər iki halda nəticə eyni olur. -The call to `typeof x` returns a string with the type name: +`typeof x` ifadəsi arqumentin tipini `string` formatında qaytarır: ```js typeof undefined // "undefined" @@ -239,11 +239,11 @@ typeof alert // "function" (3) */!* ``` -The last three lines may need additional explanation: +Son üç sətir əlavə izah tələb edə bilər: -1. `Math` is a built-in object that provides mathematical operations. We will learn it in the chapter . Here, it serves just as an example of an object. -2. The result of `typeof null` is `"object"`. That's wrong. It is an officially recognized error in `typeof`, kept for compatibility. Of course, `null` is not an object. It is a special value with a separate type of its own. So, again, this is an error in the language. -3. The result of `typeof alert` is `"function"`, because `alert` is a function. We'll study functions in the next chapters where we'll also see that there's no special "function" type in JavaScript. Functions belong to the object type. But `typeof` treats them differently, returning `"function"`. That's not quite correct, but very convenient in practice. +1. `Math` riyazi əməliyyatlar təqdim edən daxili obyektlərdən biridir. Biz onu fəsilində daha ətraflı öyrənəcəyik. Burada isə, sadəcə obyektin bir nümunəsi kimi istifadə olunub. +2. `typeof null` nəticəsi `"object"` olaraq qaytarılır. Bu, səhvdir. Bu, `typeof` operatorunun rəsmi olaraq tanınmış bir xətasıdır və uyğunluq səbəbilə saxlanılıb. Əslində, `null` bir obyekt deyil. O, ayrıca bir tipə malik xüsusi bir dəyərdir. Beləliklə, bu, JavaScript dilində mövcud olan bir qüsurdur. +3. `typeof alert` nəticəsi `"function"` olur, çünki, `alert` bir funksiyadır. Biz funksiyaları növbəti fəsillərdə öyrənəcəyik. Orada görəcəyik ki, əslində JavaScript-də xüsusi bir "function" tipi yoxdur. Funksiyalar `object` tipinə daxildir. Lakin, `typeof` funksiyalara fərqli davranaraq `"function"` kimi qaytarır. Bu tam doğru deyil, lakin praktikada çox rahatdır. ## Summary From f798df20a99aa7d5f686d28da7f65c9fe448a73a Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 23:25:39 +0400 Subject: [PATCH 11/13] 1.2.5. Article - Summary --- 1-js/02-first-steps/05-types/article.md | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index 702ec92b7..b01a646db 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -245,23 +245,23 @@ Son üç sətir əlavə izah tələb edə bilər: 2. `typeof null` nəticəsi `"object"` olaraq qaytarılır. Bu, səhvdir. Bu, `typeof` operatorunun rəsmi olaraq tanınmış bir xətasıdır və uyğunluq səbəbilə saxlanılıb. Əslində, `null` bir obyekt deyil. O, ayrıca bir tipə malik xüsusi bir dəyərdir. Beləliklə, bu, JavaScript dilində mövcud olan bir qüsurdur. 3. `typeof alert` nəticəsi `"function"` olur, çünki, `alert` bir funksiyadır. Biz funksiyaları növbəti fəsillərdə öyrənəcəyik. Orada görəcəyik ki, əslində JavaScript-də xüsusi bir "function" tipi yoxdur. Funksiyalar `object` tipinə daxildir. Lakin, `typeof` funksiyalara fərqli davranaraq `"function"` kimi qaytarır. Bu tam doğru deyil, lakin praktikada çox rahatdır. -## Summary +## Xülasə -There are 8 basic data types in JavaScript. +JavaScript-də 8 sadə verilən tipi mövcuddur: -- `number` for numbers of any kind: integer or floating-point, integers are limited by ±253. -- `bigint` is for integer numbers of arbitrary length. -- `string` for strings. A string may have one or more characters, there's no separate single-character type. -- `boolean` for `true`/`false`. -- `null` for unknown values -- a standalone type that has a single value `null`. -- `undefined` for unassigned values -- a standalone type that has a single value `undefined`. -- `object` for more complex data structures. -- `symbol` for unique identifiers. +- **`number`**: İstənilən növ rəqəmlər üçün, tam və ya onluq kəsr dəyərləri daxildir. Tam ədədlər ±253 həddində məhdudlaşdırılıb. +- **`bigint`**: İxtiyari uzunluqlu tam ədədlər üçündür. +- **`string`**: "mətn" tipidir. Bir `string` bir və ya daha çox simvolu ehtiva edə bilər. Tək simvol üçün ayrıca bir tip mövcud deyil. +- **`boolean`**: `true` və `false` məntiqi dəyərləri üçün istifadə olunur. +- **`null`**: Naməlum dəyərlər üçün nəzərdə tutulmuş ayrıca bir tipdir, yalnız `null` dəyərinə sahibdir. +- **`undefined`**: Mənimsədilməmiş dəyərlər üçün ayrıca bir tipdir, yalnız `undefined` dəyərinə sahibdir. +- **`object`**: Daha mürəkkəb verilən strukturlarını saxlamaq üçün istifadə olunur. +- **`symbol`**: Unikal identifikatorlar yaratmaq üçün istifadə olunur. -The `typeof` operator allows us to see which type is stored in a variable. +`typeof` dəyişənin tipini müəyyənləşdirməyə imkan verir: -- Two forms: `typeof x` or `typeof(x)`. -- Returns a string with the name of the type, like `"string"`. -- For `null` returns `"object"` -- this is an error in the language, it's not actually an object. +- İki sintaksis mövcuddur: `typeof x` və ya `typeof(x)`. +- `string` olaraq tipin adını qaytarır, məsələn, `"string"`. +- `null` dəyəri üçün `"object"` qaytarır -- bu, dilin daxilində olan bir səhvdir. Əslində, `null` bir obyekt deyil. -In the next chapters, we'll concentrate on primitive values and once we're familiar with them, we'll move on to objects. +Növbəti fəsillərdə, əvvəlcə ibtidai (primitive) dəyərləri öyrənəcəyik və onlarla tanış olduqdan sonra obyektlərə keçəcəyik. \ No newline at end of file From a14c6e7e461d9acb1e6df7718222ae5f270a917b Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 23:41:12 +0400 Subject: [PATCH 12/13] 1.2.5. Article - String quotes --- .../05-types/1-string-quotes/solution.md | 14 +++++++------- .../05-types/1-string-quotes/task.md | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/1-js/02-first-steps/05-types/1-string-quotes/solution.md b/1-js/02-first-steps/05-types/1-string-quotes/solution.md index 68a13c15b..9352df18b 100644 --- a/1-js/02-first-steps/05-types/1-string-quotes/solution.md +++ b/1-js/02-first-steps/05-types/1-string-quotes/solution.md @@ -1,15 +1,15 @@ -Backticks embed the expression inside `${...}` into the string. +Tərs dırnaqlar (backticks: ``) `${...}` daxilində ifadəni mətndə yerləşdirir. ```js run let name = "Ilya"; -// the expression is a number 1 -alert( `hello ${1}` ); // hello 1 +// İfadənin çıxışı bir rəqəmdir: 1 +alert( `salam ${1}` ); // salam 1 -// the expression is a string "name" -alert( `hello ${"name"}` ); // hello name +// İfadənin çıxışı bir mətndir: "ad" +alert( `salam ${"ad"}` ); // salam ad -// the expression is a variable, embed it -alert( `hello ${name}` ); // hello Ilya +// İfadə dəyişən olduğundan, dəyişənin dəyəri istifadə olunacaq +alert( `salam ${name}` ); // salam Ilya ``` diff --git a/1-js/02-first-steps/05-types/1-string-quotes/task.md b/1-js/02-first-steps/05-types/1-string-quotes/task.md index 14ea6b4d6..a68ac6675 100644 --- a/1-js/02-first-steps/05-types/1-string-quotes/task.md +++ b/1-js/02-first-steps/05-types/1-string-quotes/task.md @@ -2,16 +2,16 @@ importance: 5 --- -# String quotes +# String dırnaqları -What is the output of the script? +Skriptin nəticəsi nə olacaq? ```js let name = "Ilya"; -alert( `hello ${1}` ); // ? +alert( `salam ${1}` ); // ? -alert( `hello ${"name"}` ); // ? +alert( `salam ${"ad"}` ); // ? -alert( `hello ${name}` ); // ? +alert( `salam ${name}` ); // ? ``` \ No newline at end of file From aab31b29fbfa3f19dece7d4bf3ff35a4e0773b64 Mon Sep 17 00:00:00 2001 From: Eldar Shahmaliyev Date: Sun, 19 Jan 2025 23:42:31 +0400 Subject: [PATCH 13/13] Fix --- 1-js/02-first-steps/05-types/1-string-quotes/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/05-types/1-string-quotes/solution.md b/1-js/02-first-steps/05-types/1-string-quotes/solution.md index 9352df18b..1f4c1f38e 100644 --- a/1-js/02-first-steps/05-types/1-string-quotes/solution.md +++ b/1-js/02-first-steps/05-types/1-string-quotes/solution.md @@ -1,5 +1,5 @@ -Tərs dırnaqlar (backticks: ``) `${...}` daxilində ifadəni mətndə yerləşdirir. +Tərs dırnaqlar (backticks: ``) `${...}` daxilində ifadəni mətnə yerləşdirir. ```js run let name = "Ilya";