Skip to content

Commit ac06e40

Browse files
authored
Update README.md
1 parent 12e03a3 commit ac06e40

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,36 @@ you shout when reading code](http://www.osnews.com/images/comics/wtfm.jpg)
3838
ในท้ายที่สุดแล้ว เราจะกำจัดส่วนที่ไม่สมบูรณ์ออกไป อย่าเพิ่งโทษตัวเองกับแบบร่างแรกที่ต้องการการปรับปรุง
3939
แต่จงจัดการกับโค้ดซะ!
4040

41-
## **Variables**
42-
### Use meaningful and pronounceable variable names
41+
## **ตัวแปร**
42+
### ใช้ชื่อตัวแปรที่สือความหมายและอ่านออกเสียงได้
4343

44-
**Bad:**
44+
**ตัวอย่างที่ไม่ดี:**
4545
```javascript
4646
const yyyymmdstr = moment().format('YYYY/MM/DD');
4747
```
4848

49-
**Good:**
49+
**ตัวอย่างที่ดี:**
5050
```javascript
5151
const currentDate = moment().format('YYYY/MM/DD');
5252
```
5353
**[⬆ back to top](#table-of-contents)**
5454

55-
### Use the same vocabulary for the same type of variable
55+
### ใช้คำเดียวกันสำหรับตัวแปรที่ใช้งานแบบเดียวกัน
5656

57-
**Bad:**
57+
**ตัวอย่างที่ไม่ดี:**
5858
```javascript
5959
getUserInfo();
6060
getClientData();
6161
getCustomerRecord();
6262
```
6363

64-
**Good:**
64+
**ตัวอย่างที่ดี:**
6565
```javascript
6666
getUser();
6767
```
6868
**[⬆ back to top](#table-of-contents)**
6969

70-
### Use searchable names
70+
### ใช้ชื่อที่สามารถค้นหาได้
7171
We will read more code than we will ever write. It's important that the code we
7272
do write is readable and searchable. By *not* naming variables that end up
7373
being meaningful for understanding our program, we hurt our readers.
@@ -76,14 +76,14 @@ Make your names searchable. Tools like
7676
[ESLint](https://github.com/eslint/eslint/blob/660e0918933e6e7fede26bc675a0763a6b357c94/docs/rules/no-magic-numbers.md)
7777
can help identify unnamed constants.
7878

79-
**Bad:**
79+
**ตัวอย่างที่ไม่ดี:**
8080
```javascript
8181
// What the heck is 86400000 for?
8282
setTimeout(blastOff, 86400000);
8383

8484
```
8585

86-
**Good:**
86+
**ตัวอย่างที่ดี:**
8787
```javascript
8888
// Declare them as capitalized `const` globals.
8989
const MILLISECONDS_IN_A_DAY = 86400000;
@@ -93,15 +93,15 @@ setTimeout(blastOff, MILLISECONDS_IN_A_DAY);
9393
```
9494
**[⬆ back to top](#table-of-contents)**
9595

96-
### Use explanatory variables
97-
**Bad:**
96+
### ใช้ตัวแปรเพื่อเป็นการอธิบาย code
97+
**ตัวอย่างที่ไม่ดี:**
9898
```javascript
9999
const address = 'One Infinite Loop, Cupertino 95014';
100100
const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
101101
saveCityZipCode(address.match(cityZipCodeRegex)[1], address.match(cityZipCodeRegex)[2]);
102102
```
103103

104-
**Good:**
104+
**ตัวอย่างที่ดี:**
105105
```javascript
106106
const address = 'One Infinite Loop, Cupertino 95014';
107107
const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
@@ -110,10 +110,10 @@ saveCityZipCode(city, zipCode);
110110
```
111111
**[⬆ back to top](#table-of-contents)**
112112

113-
### Avoid Mental Mapping
114-
Explicit is better than implicit.
113+
### หลีกเลี่ยงการตั้งชื่อที่มีแค่เราที่เข้าใจ
114+
เขียนให้ชัดเจนดีกว่าเขียนแล้วต้องมาเดา.
115115

116-
**Bad:**
116+
**ตัวอย่างที่ไม่ดี:**
117117
```javascript
118118
const locations = ['Austin', 'New York', 'San Francisco'];
119119
locations.forEach((l) => {
@@ -127,7 +127,7 @@ locations.forEach((l) => {
127127
});
128128
```
129129

130-
**Good:**
130+
**ตัวอย่างที่ดี:**
131131
```javascript
132132
const locations = ['Austin', 'New York', 'San Francisco'];
133133
locations.forEach((location) => {

0 commit comments

Comments
 (0)