Movatterモバイル変換


[0]ホーム

URL:


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

Destructuring assignment#195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ImVietnam wants to merge13 commits intojavascript-tutorial:master
base:master
Choose a base branch
Loading
fromImVietnam:patch-20
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff 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 thedestructuring assignmentthat reads:
Viếtdestructuring assignmentcó 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 destructuringto 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

[8]ページ先頭

©2009-2025 Movatter.jp