Skip to content

Commit 3b490e8

Browse files
committed
1.2.5. Article - typeof operator
1 parent e672a5a commit 3b490e8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

1-js/02-first-steps/05-types/article.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,18 @@ Bütün digər tiplər "primitiv (primitive)" tip adlanır, çünki, onların d
200200
201201
`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.
202202
203-
## The typeof operator [#type-typeof]
203+
### `typeof` operatoru [#type-typeof]
204204
205-
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.
205+
`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.
206206
207-
It supports two forms of syntax:
207+
Bu operator iki sintaksisi dəstəkləyir:
208208
209-
1. As an operator: `typeof x`.
210-
2. As a function: `typeof(x)`.
209+
1. Operator kimi: `typeof x`.
210+
2. Funksiya kimi: `typeof(x)`.
211211
212-
In other words, it works with parentheses or without them. The result is the same.
212+
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.
213213
214-
The call to `typeof x` returns a string with the type name:
214+
`typeof x` ifadəsi arqumentin tipini `string` formatında qaytarır:
215215
216216
```js
217217
typeof undefined // "undefined"
@@ -239,11 +239,11 @@ typeof alert // "function" (3)
239239
*/!*
240240
```
241241
242-
The last three lines may need additional explanation:
242+
Son üç sətir əlavə izah tələb edə bilər:
243243
244-
1. `Math` is a built-in object that provides mathematical operations. We will learn it in the chapter <info:number>. Here, it serves just as an example of an object.
245-
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.
246-
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.
244+
1. `Math` riyazi əməliyyatlar təqdim edən daxili obyektlərdən biridir. Biz onu <info:number> fəsilində daha ətraflı öyrənəcəyik. Burada isə, sadəcə obyektin bir nümunəsi kimi istifadə olunub.
245+
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.
246+
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.
247247
248248
## Summary
249249

0 commit comments

Comments
 (0)