Skip to content

Commit 0af2f7a

Browse files
Destructuring assignment (#222)
1 parent da25c0e commit 0af2f7a

File tree

4 files changed

+208
-208
lines changed

4 files changed

+208
-208
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
```js run
33
let user = {
4-
name: "John",
4+
name: "Іван",
55
years: 30
66
};
77

88
let {name, years: age, isAdmin = false} = user;
99

10-
alert( name ); // John
10+
alert( name ); // Іван
1111
alert( age ); // 30
1212
alert( isAdmin ); // false
1313
```

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ importance: 5
22

33
---
44

5-
# Destructuring assignment
5+
# Деструктуроване присвоєння
66

7-
We have an object:
7+
У нас є об’єкт:
88

99
```js
1010
let user = {
11-
name: "John",
11+
name: "Іван",
1212
years: 30
1313
};
1414
```
1515

16-
Write the destructuring assignment that reads:
16+
Напишіть деструктуроване присвоєння, яке зчитує:
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
25-
let user = { name: "John", years: 30 };
25+
let user = { name: "Іван", years: 30 };
2626

27-
// your code to the left side:
27+
// ваш код зліва:
2828
// ... = user
2929

30-
alert( name ); // John
30+
alert( name ); // Іван
3131
alert( age ); // 30
3232
alert( isAdmin ); // false
3333
```

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ importance: 5
22

33
---
44

5-
# The maximal salary
5+
# Максимальна зарплата
66

7-
There is a `salaries` object:
7+
Є об’єкт `salaries`:
88

99
```js
1010
let salaries = {
11-
"John": 100,
12-
"Pete": 300,
13-
"Mary": 250
11+
"Іван": 100,
12+
"Петро": 300,
13+
"Марія": 250
1414
};
1515
```
1616

17-
Create the function `topSalary(salaries)` that returns the name of the top-paid person.
17+
Створіть функцію `topSalary(salaries)` яка повертає ім’я найбільш високооплачуваної особи.
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+
P.S. Використовуйте `Object.entries` і деструктурування для перебору пар ключ/значення.

0 commit comments

Comments
 (0)