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
@@ -164,33 +164,34 @@ Bazen, `this`'in değeri tamamen evrensel obje olur. Bu çok nadir de olsa bazı
164
164
165
165
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.
166
166
167
-
## Using for polyfills
167
+
## Polyfill'ler İçin Kullanma
168
168
169
-
We use the global object to test for support of modern language features.
169
+
Modern dil özelliklerinin desteğini test etmek için global nesneyi kullanıyoruz.
170
170
171
-
For instance, test if a built-in `Promise` object exists (it doesn't in really old browsers):
171
+
Örneğin, yerleşik bir "Promise" nesnesinin olup olmadığını test edelim (gerçekten eski tarayıcılarda yoktur):
172
172
```js run
173
173
if (!window.Promise) {
174
-
alert("Your browser is really old!");
174
+
alert("Senin tarayıcın gerçekten çok yaşlı");
175
175
}
176
176
```
177
177
178
-
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.
178
+
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.
179
179
180
180
```js run
181
181
if (!window.Promise) {
182
-
window.Promise = ... // custom implementation of the modern language feature
182
+
window.Promise = ... // modern dil özelliğinin özel uygulaması
183
183
}
184
184
```
185
185
186
-
## Summary
186
+
## Özet
187
187
188
-
- The global object holds variables that should be available everywhere.
188
+
- Global nesne, her yerde bulunması gereken değişkenleri tutar.
189
189
190
-
That includes JavaScript built-ins, such as `Array` and environment-specific values, such as `window.innerHeight` -- the window height in the browser.
191
-
- The global object has a universal name `globalThis`.
190
+
Buna "Array" gibi JavaScript yerleşikleri ve "window.innerHeight" gibi ortama özgü değerler - tarayıcıdaki pencere yüksekliği dahildir.
191
+
- Global nesnenin evrensel bir adı 'globalThis' vardır.
192
192
193
-
...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).
194
-
- We should store values in the global object only if they're truly global for our project. And keep their number at minimum.
195
-
- In-browser, unless we're using [modules](info:modules), global functions and variables declared with `var` become a property of the global object.
196
-
- To make our code future-proof and easier to understand, we should access properties of the global object directly, as `window.x`.
193
+
...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).
194
+
195
+
- Değerleri yalnızca projemiz için gerçekten küresellerse global nesnede saklamalıyız. Ve sayılarını minimumda tutun.
196
+
- 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.
197
+
- 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