Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f4b2c1a

Browse files
committed
Translate the "Methods of primitives" section to Thai and update examples
1 parent 6038135 commit f4b2c1a

File tree

1 file changed

+4
-3
lines changed
  • 1-js/05-data-types/01-primitives-methods

1 file changed

+4
-3
lines changed

‎1-js/05-data-types/01-primitives-methods/article.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ alert( n.toFixed(2) ); // 1.23
7979
เราจะได้เรียนรู้เมท็อดเฉพาะของข้อมูลปฐมภูมิแต่ละตัวเพิ่มเติมในบท <info:number> และ <info:string>
8080

8181

82-
```warn header="constructor ของ String/Number/Boolean ใช้สําหรับภายในเท่านั้น"
82+
````warn header="constructor ของ String/Number/Boolean ใช้สําหรับภายในเท่านั้น"
8383
บางภาษา เช่น Java อนุญาตให้เราสร้าง "ออบเจ็กต์ wrapper" สําหรับข้อมูลปฐมภูมิได้โดยใช้ syntax แบบ `new Number(1)` หรือ `new Boolean(false)`
8484
8585
ใน JavaScript ก็ทําแบบนั้นได้ด้วยเหตุผลทางประวัติ แต่ *ไม่แนะนําให้ใช้เด็ดขาด* เพราะอาจเกิดปัญหาได้มากมาย
@@ -108,17 +108,18 @@ if (zero) { // zero เป็น true เพราะเป็นออบเจ
108108
```js
109109
let num = Number("123"); // แปลง string เป็น number
110110
```
111-
```
111+
````
112112

113113

114-
```warn header="null/undefined ไม่มีเมท็อด"
114+
````warn header="null/undefined ไม่มีเมท็อด"
115115
ข้อมูลปฐมภูมิพิเศษ `null` กับ `undefined` ถือเป็นข้อยกเว้น ไม่มี "ออบเจ็กต์ wrapper" สําหรับค่าเหล่านี้ และก็ไม่มีเมท็อดอะไรด้วย แปลว่าพวกมันคือข้อมูลปฐมภูมิล้วนๆ ที่สุดเลยก็ว่าได้
116116
117117
การพยายามเข้าถึงพร็อพเพอร์ตี้ของค่าพวกนี้จะทําให้เกิด error:
118118
119119
```js run
120120
alert(null.test); // error
121121
```
122+
````
122123

123124
## สรุป
124125

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /