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/06-advanced-functions/05-global-object/article.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,33 +162,34 @@ Bazen, `this`'in değeri tamamen evrensel obje olur. Bu çok nadir de olsa bazı
162
162
163
163
Tanım gereği, `this` bu durumda evrensel obje olmalı, Node.JS ortamında olmasa bile `this` evrensel objedir. Bu eski kodlar ile uyumluluk amacıyladır, sıkı modda `this` tanımsız olabilir.
164
164
165
-
## Using for polyfills
165
+
## Polyfill'ler İçin Kullanma
166
166
167
-
We use the global object to test for support of modern language features.
167
+
Modern dil özelliklerinin desteğini test etmek için global nesneyi kullanıyoruz.
168
168
169
-
For instance, test if a built-in`Promise` object exists (it doesn't in really old browsers):
169
+
Örneğin, yerleşik bir "Promise" nesnesinin olup olmadığını test edelim (gerçekten eski tarayıcılarda yoktur):
170
170
```js run
171
171
if (!window.Promise) {
172
-
alert("Your browser is really old!");
172
+
alert("Senin tarayıcın gerçekten çok yaşlı");
173
173
}
174
174
```
175
175
176
-
If there's none (say, we're in an old browser), we can create "polyfills": add functions that are not supported by the environment, but exist in the modern standard.
176
+
Hiçbiri yoksa (örneğin, eski bir tarayıcıdayız), "pollyfills(çoklu dolgular)" oluşturabiliriz: çevre tarafından desteklenmeyen, ancak modern standartta var olan işlevler ekleyebiliriz.
177
177
178
178
```js run
179
179
if (!window.Promise) {
180
-
window.Promise = ... // custom implementation of the modern language feature
180
+
window.Promise = ... // modern dil özelliğinin özel uygulaması
181
181
}
182
182
```
183
183
184
-
## Summary
184
+
## Özet
185
185
186
-
- The global object holds variables that should be available everywhere.
186
+
- Global nesne, her yerde bulunması gereken değişkenleri tutar.
187
187
188
-
That includes JavaScript built-ins, such as `Array` and environment-specific values, such as `window.innerHeight` -- the window height in the browser.
189
-
- The global object has a universal name `globalThis`.
188
+
Buna "Array" gibi JavaScript yerleşikleri ve "window.innerHeight" gibi ortama özgü değerler - tarayıcıdaki pencere yüksekliği dahildir.
189
+
- Global nesnenin evrensel bir adı 'globalThis' vardır.
190
190
191
-
...But more often is referred by "old-school" environment-specific names, such as `window` (browser) and `global` (Node.js). As `globalThis` is a recent proposal, it's not supported in non-Chromium Edge (but can be polyfilled).
192
-
- We should store values in the global object only if they're truly global for our project. And keep their number at minimum.
193
-
- In-browser, unless we're using [modules](info:modules), global functions and variables declared with`var` become a property of the global object.
194
-
- To make our code future-proof and easier to understand, we should access properties of the global object directly, as `window.x`.
191
+
...Ancak daha sık olarak "window(tarayıcı)" ve "global(Node.js)" gibi "eski tarz" çevreye özgü adlarla anılır. "globalThis" yeni bir teklif olduğundan, Chromium Edge dışında desteklenmemektedir (ancak polyfilled olabilir).
192
+
193
+
- Değerleri yalnızca projemiz için gerçekten küresellerse global nesnede saklamalıyız. Ve sayılarını minimumda tutun.
194
+
- Tarayıcıda, [modules](info:modules) kullanmadığımız sürece, 'var' ile bildirilen global işlevler ve değişkenler global nesnenin bir özelliği haline gelir.
195
+
- Kodumuzu geleceğe dönük ve daha kolay anlaşılır kılmak için global nesnenin özelliklerine doğrudan "window.x" olarak erişmeliyiz.
0 commit comments