@@ -991,11 +991,11 @@ console.log(`Calisanin ismi: ${calisan.getIsim()}`); // Calisanin ismi: John Doe
991991
992992
993993## ** Sınıflar**
994- ### Prefer ES2015/ES6 classes over ES5 plain functions
995- It's very difficult to get readable class inheritance , construction, and method
996- definitions for classical ES5 classes. If you need inheritance (and be aware
997- that you might not), then prefer ES2015/ES6 classes. However, prefer small functions over
998- classes until you find yourself needing larger and more complex objects .
994+ ### Yalın ES5 fonksiyonları yerine ES2015/ES6 sınıflarını tercih edin
995+ Klasik ES5 sınıfları için okunabilir sınıf kalıtımları , construction ve metod tanımlarını
996+ almak çok zordur. Eğer kalıtıma ihtiyacınız varsa (ihtiyacınızın olmayabileceğinin farkında olun),
997+ o zaman ES2015/ES6 sınıflarını tercih edin. Ancak, daha büyük ve karmaşık nesnelerle uğraşana
998+ kadar sınıflar yerine küçük fonksiyonları kullanın .
999999
10001000** Kötü:**
10011001``` javascript
@@ -1067,81 +1067,81 @@ class Human extends Mammal {
10671067** [ ⬆ en başa dön] ( #içindekiler ) **
10681068
10691069
1070- ### Use method chaining
1071- This pattern is very useful in JavaScript and you see it in many libraries such
1072- as jQuery and Lodash. It allows your code to be expressive, and less verbose .
1073- For that reason, I say, use method chaining and take a look at how clean your code
1074- will be. In your class functions, simply return ` this ` at the end of every function ,
1075- and you can chain further class methods onto it .
1070+ ### Metod zincirleme yöntemini kullanın
1071+ Bu yöntem JavaScript'te çok kullanışlıdır ve bunu jQuery ve Lodash gibi birçok kütüphanede görebilirsiniz.
1072+ Kodunuzun daha anlamlı ve daha az detaylı olmasını sağlar .
1073+ Bu nedenle, metod zincirleme yöntemini bir kez kullanın ve kodunuzun ne kadar temiz olacağına bir göz atın derim.
1074+ Sınıf fonksiyonlarında basitçe her fonksiyon sonunda ` this ` döndürün ,
1075+ böylece daha fazla sınıf metodu zincirleyebilirsiniz .
10761076
10771077** Kötü:**
10781078``` javascript
1079- class Car {
1080- constructor (make , model , color ) {
1081- this .make = make ;
1079+ class Araba {
1080+ constructor (marka , model , renk ) {
1081+ this .marka = marka ;
10821082 this .model = model;
1083- this .color = color ;
1083+ this .renk = renk ;
10841084 }
10851085
1086- setMake ( make ) {
1087- this .make = make ;
1086+ setMarka ( marka ) {
1087+ this .marka = marka ;
10881088 }
10891089
10901090 setModel (model ) {
10911091 this .model = model;
10921092 }
10931093
1094- setColor ( color ) {
1095- this .color = color ;
1094+ setRenk ( renk ) {
1095+ this .renk = renk ;
10961096 }
10971097
1098- save () {
1099- console .log (this .make , this .model , this .color );
1098+ kaydet () {
1099+ console .log (this .marka , this .model , this .renk );
11001100 }
11011101}
11021102
1103- const car = new Car (' Ford' ,' F-150' ,' red ' );
1104- car . setColor ( ' pink ' );
1105- car . save ();
1103+ const araba = new Araba (' Ford' ,' F-150' ,' kirmizi ' );
1104+ araba . setRenk ( ' pembe ' );
1105+ araba . kaydet ();
11061106```
11071107
11081108** İyi:**
11091109``` javascript
1110- class Car {
1111- constructor (make , model , color ) {
1112- this .make = make ;
1110+ class Araba {
1111+ constructor (marka , model , renk ) {
1112+ this .marka = marka ;
11131113 this .model = model;
1114- this .color = color ;
1114+ this .renk = renk ;
11151115 }
11161116
1117- setMake ( make ) {
1118- this .make = make ;
1119- // NOTE: Returning this for chaining
1117+ setMarka ( marka ) {
1118+ this .marka = marka ;
1119+ // NOT: Zincirleme için ' this' döndürülüyor
11201120 return this ;
11211121 }
11221122
11231123 setModel (model ) {
11241124 this .model = model;
1125- // NOTE: Returning this for chaining
1125+ // NOT: Zincirleme için ' this' döndürülüyor
11261126 return this ;
11271127 }
11281128
1129- setColor ( color ) {
1130- this .color = color ;
1131- // NOTE: Returning this for chaining
1129+ setRenk ( renk ) {
1130+ this .renk = renk ;
1131+ // NOT: Zincirleme için ' this' döndürülüyor
11321132 return this ;
11331133 }
11341134
1135- save () {
1136- console .log (this .make , this .model , this .color );
1137- // NOTE: Returning this for chaining
1135+ kaydet () {
1136+ console .log (this .marka , this .model , this .renk );
1137+ // NOT: Zincirleme için ' this' döndürülüyor
11381138 return this ;
11391139 }
11401140}
11411141
1142- const car = new Car (' Ford' ,' F-150' ,' red ' )
1143- .setColor ( ' pink ' )
1144- .save ();
1142+ const araba = new Araba (' Ford' ,' F-150' ,' kirmizi ' )
1143+ .setRenk ( ' pembe ' )
1144+ .kaydet ();
11451145```
11461146** [ ⬆ en başa dön] ( #içindekiler ) **
11471147
0 commit comments