◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# Destructuring assignment

We have an object:

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

Write the destructuring assignment that reads:

- `name` property into the variable `name`.
- `years` property into the variable `age`.
- `isAdmin` property into the variable `isAdmin` (false if absent)

The values after the assignment should be:

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

// your code to the left side:
// ... = user

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

---

# The maximal salary

There is a `salaries` object:

```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.

- If `salaries` is empty, it should return `null`.
- If there are multiple top-paid persons, return any of them.

P.S. Use `Object.entries` and destructuring to iterate over key/value pairs.
Loading
Toggle all file notes Toggle all file annotations