Skip to content

Commit a3b2bf4

Browse files
committed
docs(destructuring): polish thai lesson and exercises
1 parent d4b803f commit a3b2bf4

3 files changed

Lines changed: 99 additions & 99 deletions

File tree

‎1-js/05-data-types/10-destructuring-assignment/1-destruct-user/task.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# Destructuring assignment
5+
# แยกค่าด้วย destructuring assignment
66

7-
We have an object:
7+
กำหนดออบเจ็กต์ (object) ให้ดังนี้:
88

99
```js
1010
let user = {
@@ -13,18 +13,18 @@ let user = {
1313
};
1414
```
1515

16-
Write the destructuring assignment that reads:
16+
เขียน destructuring assignment เพื่ออ่านค่าจากพร็อพเพอร์ตี้ (property) มาใส่ตัวแปร (variable) ตามเงื่อนไขต่อไปนี้:
1717

18-
- `name` property into the variable `name`.
19-
- `years` property into the variable `age`.
20-
- `isAdmin` property into the variable `isAdmin` (false, if no such property)
18+
- นำค่าของ `name` มาใส่ตัวแปร `name`
19+
- นำค่าของ `years` มาใส่ตัวแปร `age`
20+
- นำค่าของ `isAdmin` มาใส่ตัวแปร `isAdmin` ถ้าไม่มีพร็อพเพอร์ตี้นี้ ให้ใช้ค่า `false`
2121

22-
Here's an example of the values after your assignment:
22+
เมื่อกำหนดค่าแล้ว ตัวแปรควรมีค่าตามตัวอย่างนี้:
2323

2424
```js
2525
let user = { name: "John", years: 30 };
2626

27-
// your code to the left side:
27+
// เขียนโค้ดของคุณทางซ้ายของเครื่องหมายเท่ากับ:
2828
// ... = user
2929

3030
alert( name ); // John

‎1-js/05-data-types/10-destructuring-assignment/6-max-salary/task.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# The maximal salary
5+
# หาคนที่ได้เงินเดือนสูงสุด
66

7-
There is a `salaries` object:
7+
กำหนดออบเจ็กต์ (object) `salaries` ให้ดังนี้:
88

99
```js
1010
let salaries = {
@@ -14,9 +14,9 @@ let salaries = {
1414
};
1515
```
1616

17-
Create the function `topSalary(salaries)` that returns the name of the top-paid person.
17+
เขียนฟังก์ชัน (function) `topSalary(salaries)` ที่คืนค่า (return) เป็นชื่อของคนที่ได้เงินเดือนสูงสุด
1818

19-
- If `salaries` is empty, it should return `null`.
20-
- If there are multiple top-paid persons, return any of them.
19+
- ถ้า `salaries` เป็นออบเจ็กต์ว่าง ให้คืนค่า `null`
20+
- ถ้ามีหลายคนได้เงินเดือนสูงสุดเท่ากัน ให้คืนชื่อคนใดคนหนึ่งในกลุ่มนั้น
2121

22-
P.S. Use `Object.entries` and destructuring to iterate over key/value pairs.
22+
ให้ใช้ `Object.entries` ร่วมกับ destructuring เพื่อวนอ่านข้อมูลทีละคู่ โดยแต่ละคู่ประกอบด้วยคีย์ (key) และค่า

0 commit comments

Comments
 (0)