|
1 | 1 | # Müasir mod, "use strict" |
2 | 2 |
|
3 | | -For a long time, JavaScript evolved without compatibility issues. New features were added to the language while old functionality didn't change. |
| 3 | +JavaScript uzun müddət ərzində uyğunsuzluq problemləri olmadan inkişaf etdi. Köhnə xüsusiyyətlər dəyişdirilmədən, dilə yeni xüsusiyyətlər əlavə olundu. |
4 | 4 |
|
| 5 | +Bunun üstünlüyü mövcud kodun işləmə qabiliyyətini heç vaxt pozmaması idi. Lakin mənfi tərəfi o idi ki, JavaScript'in yaradıcılarının etdiyi hərhansı bir səhv və ya düzgün olmayan bir qərar dilin daimi bir hissəsinə çevrilirdi. |
5 | 6 |
|
6 | | -That had the benefit of never breaking existing code. But the downside was that any mistake or an imperfect decision made by JavaScript's creators got stuck in the language forever. |
7 | | - |
8 | | -This was the case until 2009 when ECMAScript 5 (ES5) appeared. It added new features to the language and modified some of the existing ones. To keep the old code working, most such modifications are off by default. You need to explicitly enable them with a special directive: `"use strict"`. |
| 7 | +Bu vəziyyət 2009-cu ildə ECMAScript 5 (ES5) standartı təqdim edilənə qədər davam etdi. ES5 dilə yeni xüsusiyyətlər əlavə etdi və mövcud olan bəzi xüsusiyyətləri dəyişdirdi. Köhnə kodların işləməyə davam etməsi üçün bir çox dəyişikliklər susqunluq halında (by default) deaktiv edilmişdi. Bu dəyişiklikləri aktiv etmək üçün xüsusi bir direktivdən istifadə etməlisiniz: `"use strict"`. |
9 | 8 |
|
10 | 9 | ## "use strict" |
11 | 10 |
|
12 | | -The directive looks like a string: `"use strict"` or `'use strict'`. When it is located at the top of a script, the whole script works the "modern" way. |
| 11 | +Bu direktiv bir string kimi görünür: `"use strict"` və ya `'use strict'`. Əgər bu direktiv bir skriptin ən üst hissəsində yerləşdirilərsə, həmin skript "müasir" qaydada işləyir. |
13 | 12 |
|
14 | | -For example: |
| 13 | +Məsələn: |
15 | 14 |
|
16 | 15 | ```js |
17 | 16 | "use strict"; |
18 | 17 |
|
19 | | -// this code works the modern way |
| 18 | +// bu kod müasir qaydada işləyir |
20 | 19 | ... |
21 | 20 | ``` |
22 | 21 |
|
23 | | -We will learn functions (a way to group commands) soon. Looking ahead, let's note that `"use strict"` can be put at the beginning of the function body instead of the whole script. Doing that enables strict mode in that function only. But usually, people use it for the whole script. |
24 | | - |
| 22 | +Biz funksiyaları (ifadələri qruplaşdırmaq üçün bir yoldur) tezliklə öyrənəcəyik. İndilik isə qeyd etməliyik ki, `"use strict"` direktivini skriptin ən üstündə yerləşdirmək əvəzinə, bir funksiyanın başlanğıcına da əlavə etmək mümkündür. Bu halda yalnız həmin funksiya müasir qaydada işləyəcək. Lakin, adətən insanlar bu direktivi bütün skript üçün istifadə edirlər. |
25 | 23 |
|
26 | 24 | ````warn header="Ensure that \"use strict\" is at the top" |
27 | 25 | Please make sure that `"use strict"` is at the top of your scripts, otherwise strict mode may not be enabled. |
|
0 commit comments