Skip to content

Commit 4dfd6a4

Browse files
authored
Merge pull request #56 from Anilsenay/patch-3
Son kısımların çevirisi yapıldı
2 parents 1e5bd05 + d8ffbc6 commit 4dfd6a4

File tree

1 file changed

+57
-56
lines changed

1 file changed

+57
-56
lines changed

1-js/02-first-steps/07-operators/article.md

Lines changed: 57 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,16 @@ Artırma/Azaltma sadece değişkenlere uygulanabilirler. `5++` gibi bir kullanı
262262
`++` ve `--` operatörleri değişkenden önce veya sonra kullanılabilirler.
263263

264264

265-
- When the operator goes after the variable, it is called a "postfix form": `counter++`.
266-
- The "prefix form" is when the operator stands before the variable: `++counter`.
265+
- Operatör değişkenden sonra geliyorsa ona "postfix form" deriz: `counter++`.
266+
- "prefix form" ise opeatörün değişkenden önce geldiği durumdur: `++counter`.
267267

268-
Both of these records do the same: increase `counter` by `1`.
268+
Bu iki durumda da aynı işlem yapılır: `counter` değişkeni `1` arttırılır.
269269

270-
Is there any difference? Yes, but we can only see it if we use the returned value of `++/--`.
270+
Peki bir farkları var? Evet, fakat bunu `++/--` işleminden dönen değerleri kullanırsak görebiliriz.
271271

272-
Let's clarify. As we know, all operators return a value. Increment/decrement is not an exception here. The prefix form returns the new value, while the postfix form returns the old value (prior to increment/decrement).
272+
Şöyle açıklayabiliriz. Bildiğimiz üzere tüm operatörler bir değer döndürür. arttırma/azaltma opeatörleri buna bir istisna değildir. Prefix formu oluşan yeni değeri döndürürken, postfix formu eski değeri(arttırma/azaltma işlemi yapılmadan önceki) döndürür.
273273

274-
To see the difference, here's the example:
274+
Farkı görebilmemiz için örneği inceleyelim:
275275

276276
```js run
277277
let counter = 1;
@@ -280,9 +280,9 @@ let a = ++counter; // (*)
280280
alert(a); // *!*2*/!*
281281
```
282282

283-
Here in the line `(*)` the prefix call `++counter` increments `counter` and returns the new value that is `2`. So the `alert` shows `2`.
283+
`(*)` satırında *prefix* formundaki `++counter` `counter` değişkenini arttırır ve yeni değer olan `2` yi döndürür. Yani `alert` bize `2` değerini gösterecektir.
284284

285-
Now let's use the postfix form:
285+
Şimdi de postfix kullanıma bakalım:
286286

287287
```js run
288288
let counter = 1;
@@ -291,53 +291,53 @@ let a = counter++; // (*) changed ++counter to counter++
291291
alert(a); // *!*1*/!*
292292
```
293293

294-
In the line `(*)` the *postfix* form `counter++` also increments `counter`, but returns the *old* value (prior to increment). So the `alert` shows `1`.
294+
`(*)` satırında *postfix* formundaki `++counter` de aynı şekilde `counter` değişkenini arttırır fakat bu sefer değişkenin *eski* değerini(arttırma işlemi yapılmadan önceki) değerini döndürür. Yani `alert` bize `1` değerini gösterecektir.
295295

296-
To summarize:
296+
Özetle:
297297

298-
- If the result of increment/decrement is not used, then there is no difference in which form to use:
298+
- Eğer arttırma/azaltma işleminin sonucunu kullanmıyorsak hangi formu kullandığımızın bir farkı olmaz:
299299

300300
```js run
301301
let counter = 0;
302302
counter++;
303303
++counter;
304-
alert( counter ); // 2, the lines above did the same
304+
alert( counter ); // 2, iki satır da aynı işlemi yaptı.
305305
```
306-
- If we'd like to increase the value *and* use the result of the operator right now, then we need the prefix form:
306+
- Eğer bir değeri arttıracak *ve* onu aynı anda(o işlem sırasında) kullanacaksak, prefix formunu kullanmamız gerekir:
307307

308308
```js run
309309
let counter = 0;
310310
alert( ++counter ); // 1
311311
```
312-
- If we'd like to increment, but use the previous value, then we need the postfix form:
312+
- Eğer arttırma yapacak fakat arttırma yapmadan yapmadan önceki değeri kullanacaksak, postfix formunu kullanmamız gerekir:
313313

314314
```js run
315315
let counter = 0;
316316
alert( counter++ ); // 0
317317
```
318318

319-
````smart header="Increment/decrement among other operators"
320-
Operators `++/--` can be used inside an expression as well. Their precedence is higher than most other arithmetical operations.
319+
````smart header="Diğer operatörler arasında arttırma/azaltma"
320+
`++/--` operatörleri ayrıca bir ifadenin içinde kullanılabilirler. Öncelikleri diğer tüm operatörlerden daha yüksektir.
321321

322-
For instance:
322+
Örneğin:
323323

324324
```js run
325325
let counter = 1;
326326
alert( 2 * ++counter ); // 4
327327
```
328328

329-
Compare with:
329+
alttaki örnek ile karşılaştıralım:
330330

331331
```js run
332332
let counter = 1;
333-
alert( 2 * counter++ ); // 2, because counter++ returns the "old" value
333+
alert( 2 * counter++ ); // 2, çünkü counter++ "eski" değeri döndürecektir
334334
```
335335

336-
Though technically allowable, such notation usually makes the code less readable. One line does multiple things -- not good.
336+
Teknik olarak doğru olmakla birlikte bu tür kullanımlar kodu daha az okunur kılar. Bir satırında birden çok işlem yapılması çok iyi değildir.
337337

338-
While reading the code, a fast "vertical" eye-scan can easily miss such `counter++`, and it won't be obvious that the variable increases.
338+
Kod okurken hızlı bir göz taraması sırasında `counter++` ifadesini gözden kaçırmamız oldukça olasıdır. Değişkenin arttırıldığı açıkça gözükmeyebilir.
339339

340-
The "one line -- one action" style is advised:
340+
"Bir satır -- bir işlem" stili önerilir:
341341

342342
```js run
343343
let counter = 1;
@@ -346,29 +346,29 @@ counter++;
346346
```
347347
````
348348

349-
## Bitwise operators
349+
## Bitsel(Bitwise) Operatörler
350350

351-
Bitwise operators treat arguments as 32-bit integer numbers and work on the level of their binary representation.
351+
Bitsel operatörler argümanlara 32-bitlik doğal sayı gibi davranır ve ikili gösterimleri düzeyinde çalışır.
352352

353-
These operators are not JavaScript-specific. They are supported in most programming languages.
353+
Bu operatörler JavaScript'e özgü değildir. Çoğu programlama dilinde bulunurlar.
354354
355-
The list of operators:
355+
Operatörlerin listesi:
356356
357-
- AND ( `&` )
358-
- OR ( `|` )
359-
- XOR ( `^` )
360-
- NOT ( `~` )
361-
- LEFT SHIFT ( `<<` )
362-
- RIGHT SHIFT ( `>>` )
363-
- ZERO-FILL RIGHT SHIFT ( `>>>` )
357+
- AND -- VE ( `&` )
358+
- OR -- VEYA ( `|` )
359+
- XOR -- ÖZEL VEYA ( `^` )
360+
- NOT -- DEĞİL ( `~` )
361+
- LEFT SHIFT -- SOLA KAYDIRMA ( `<<` )
362+
- RIGHT SHIFT -- SAĞ KAYDIRMA ( `>>` )
363+
- ZERO-FILL RIGHT SHIFT -- SIFIR DOLDURARAK SAĞ KAYDIRMA ( `>>>` )
364364
365-
These operators are used very rarely. To understand them, we should delve into low-level number representation, and it would not be optimal to do that right now. Especially because we won't need them any time soon. If you're curious, you can read the [Bitwise Operators](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators) article in MDN. It would be more practical to do that when a real need arises.
365+
Bu oparatörlerin çok nadir kullanılır. Onları anlamak için düşük seviyeli sayı temsiline girmemiz gerekiyor ve özellikle de yakın zamanda onlara ihtiyaç duymayacağımızdan şu anda bunu yapmak uygun olmayacaktır. Merak ediyorsanız, MDN ile ilgili [Bitwise Operators](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators) makalesini okuyabilirsiniz. Gerçek bir ihtiyacınız olduğunda bunu yapmak daha pratik olacaktır.
366366
367-
## Modify-in-place
367+
## Modify-in-place (Yerinde Değiştir)
368368
369-
We often need to apply an operator to a variable and store the new result in that same variable.
369+
Bazen bir değişken üzerinde bir operatör işlemi yaparız ve yeni oluşacak değerini aynı değişkende tutmak isteriz.
370370
371-
For example:
371+
Örneğin:
372372
373373
```js
374374
let n = 2;
@@ -377,62 +377,63 @@ n = n * 2;
377377
```
378378
379379
This notation can be shortened using the operators `+=` and `*=`:
380+
Bu işlemler `+=` ve `*=` kullanılarak kısaltılabilir:
380381
381382
```js run
382383
let n = 2;
383-
n += 5; // now n = 7 (same as n = n + 5)
384-
n *= 2; // now n = 14 (same as n = n * 2)
384+
n += 5; // şu an n = 7 (n = n + 5 ile aynı)
385+
n *= 2; // şu an n = 14 (n = n * 2 ile aynı)
385386
386387
alert( n ); // 14
387388
```
388389
389-
Short "modify-and-assign" operators exist for all arithmetical and bitwise operators: `/=`, `-=`, etc.
390+
Kısa olan "modify-and-assign" operatörleri tüm aritmetik ve bitsel operatörler için mevcuttur: `/=`, `-=`, vb.
390391
391-
Such operators have the same precedence as a normal assignment, so they run after most other calculations:
392+
Bu tür operatörler normal bir atama(assignment) ile aynı önceliğe sahiptir, bu yüzden diğer birçok hesaplamalardan sonra çalışırlar.
392393
393394
```js run
394395
let n = 2;
395396
396397
n *= 3 + 5;
397398
398-
alert( n ); // 16 (right part evaluated first, same as n *= 8)
399+
alert( n ); // 16 (önce sağ kısımda işleem yapıldı, n *= 8 gibi)
399400
```
400401
401-
## Comma
402+
## Virgül
402403
403-
The comma operator `,` is one of the rarest and most unusual operators. Sometimes, it's used to write shorter code, so we need to know it in order to understand what's going on.
404+
Virgül operatörü `,` nadir ve en alışılmadık operatörlerden birisidir. Bazen daha kısa kodlar yazmak için kullanılır. Bu yüzden neler olduğunu anlamak için bu operatörü de bilmemiz gerekiyor.
404405
405-
The comma operator allows us to evaluate several expressions, dividing them with a comma `,`. Each of them is evaluated but only the result of the last one is returned.
406+
Virgül operatörü birden fazla ifadeyi virgül `,` ile ayırarak hesaplamamıza olanak sağlar. Her bir ifade işleme alınır fakat bu ifadelerden sadece sonuncusu döndürülür.
406407
407-
For example:
408+
Örneğin:
408409
409410
```js run
410411
*!*
411412
let a = (1 + 2, 3 + 4);
412413
*/!*
413414
414-
alert( a ); // 7 (the result of 3 + 4)
415+
alert( a ); // 7 (3 + 4 işleminin sonucu)
415416
```
416417
417-
Here, the first expression `1 + 2` is evaluated and its result is thrown away. Then, `3 + 4` is evaluated and returned as the result.
418+
Burada, ilk ifade olan `1 + 2` işleme giriyor fakat sonucu çöpe atılıyor. Sonrasında gelen `3 + 4` işleme giriyor ve sonuç olarak geri döndürülüyor.
418419
419-
```smart header="Comma has a very low precedence"
420-
Please note that the comma operator has very low precedence, lower than `=`, so parentheses are important in the example above.
420+
```smart header="Virgül operatörünün önceliği çok düşüktür"
421+
Unutmamak gerekir ki virgül oparatörü çok düşük bir önceliğe sahiptir, önceliği `=` den bile daha düşüktür; bu yüzden yukardaki örnekte gördüğümüz gibi parantezler çok önemlidir.
421422
422-
Without them: `a = 1 + 2, 3 + 4` evaluates `+` first, summing the numbers into `a = 3, 7`, then the assignment operator `=` assigns `a = 3`, and finally the number after the comma, `7`, is not processed so it's ignored.
423+
Parantezler olmadan: `a = 1 + 2, 3 + 4` ifadesinde önce `+` işleme alınır, değerler toplanarak `a = 3, 7` ifadesine çevirilir, ondan sonra atama operatörü `=` ile `a = 3` ataması yapılır, ve sonuç olarak virgülden sonraki sayı olan `7` işlenmeyerek yok sayılır.
423424
```
424425
425-
Why do we need an operator that throws away everything except the last part?
426+
Peki neden son kısım hariç her şeyi yok sayan bir operatöre neden ihtiyacımız var?
426427
427-
Sometimes, people use it in more complex constructs to put several actions in one line.
428+
Bazen bizler, bir satırda birkaç işlem yapılan karmaşık yapılarda bu operatörü kullanırız.
428429
429-
For example:
430+
Örneğin:
430431
431432
```js
432-
// three operations in one line
433+
// Bir satırda 3 farklı işlem
433434
for (*!*a = 1, b = 3, c = a * b*/!*; a < 10; a++) {
434435
...
435436
}
436437
```
437438
438-
Such tricks are used in many JavaScript frameworks. That's why we're mentioning them. But, usually, they don't improve code readability so we should think well before using them.
439+
Bu tarz numaralar bir çok JavaScript frameworklerinde kullanılır. Bu yüzden bunladan bahsettik. Ama genelde bunlar kodun okunabilirliğini azaltıyorlar. Bu yüzden kullanmadan önce iyi düşünmek gerekir.

0 commit comments

Comments
 (0)