Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ importance: 5

# Destructuring assignment

We have an object:
Chúng ta có một đối tượng:

```js
let user = {
Expand All @@ -13,18 +13,18 @@ let user = {
};
```

Write the destructuring assignment that reads:
Viết destructuring assignment có nội dung:

- `name` property into the variable `name`.
- `years` property into the variable `age`.
- `isAdmin` property into the variable `isAdmin` (false, if no such property)
- `name` thuộc tính vào biến `name`.
- `years` thuộc tính vào biến `age`.
- `isAdmin` thuộc tính vào biến `isAdmin` (sai, nếu không có thuộc tính như vậy)

Here's an example of the values after your assignment:
Đây là một ví dụ về các giá trị sau bài tập của bạn:

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

// your code to the left side:
// mã của bạn ở phía bên trái:
// ... = user

alert( name ); // John
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# The maximal salary
# Mức lương tối đa

There is a `salaries` object:
Có một đối tượng `salaries`:

```js
let salaries = {
Expand All @@ -14,9 +14,9 @@ let salaries = {
};
```

Create the function `topSalary(salaries)` that returns the name of the top-paid person.
Tạo hàm `topSalary(salaries)` trả về tên của người được trả lương cao nhất.

- If `salaries` is empty, it should return `null`.
- If there are multiple top-paid persons, return any of them.
- Nếu `salaries` trống, nó nên trả về `null`.
- Nếu có nhiều người được trả lương cao nhất, trả lại bất kỳ ai trong số họ.

P.S. Use `Object.entries` and destructuring to iterate over key/value pairs.
Tái bút: Sử dụng `Object.entries` destructuring để lặp lại các cặp khóa/giá trị.
Loading