File tree 4 files changed +208
-208
lines changed
1-js/05-data-types/10-destructuring-assignment
4 files changed +208
-208
lines changed Original file line number Diff line number Diff line change 1
1
2
2
``` js run
3
3
let user = {
4
- name: " John " ,
4
+ name: " Іван " ,
5
5
years: 30
6
6
};
7
7
8
8
let {name, years: age, isAdmin = false } = user;
9
9
10
- alert ( name ); // John
10
+ alert ( name ); // Іван
11
11
alert ( age ); // 30
12
12
alert ( isAdmin ); // false
13
13
```
Original file line number Diff line number Diff line change @@ -2,32 +2,32 @@ importance: 5
2
2
3
3
---
4
4
5
- # Destructuring assignment
5
+ # Деструктуроване присвоєння
6
6
7
- We have an object :
7
+ У нас є об’єкт :
8
8
9
9
``` js
10
10
let user = {
11
- name: " John " ,
11
+ name: " Іван " ,
12
12
years: 30
13
13
};
14
14
```
15
15
16
- Write the destructuring assignment that reads :
16
+ Напишіть деструктуроване присвоєння, яке зчитує :
17
17
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, якщо така властивість відсутня )
21
21
22
- Here's an example of the values after your assignment :
22
+ Ось приклад значень після вашого присвоєння :
23
23
24
24
``` js
25
- let user = { name: " John " , years: 30 };
25
+ let user = { name: " Іван " , years: 30 };
26
26
27
- // your code to the left side :
27
+ // ваш код зліва :
28
28
// ... = user
29
29
30
- alert ( name ); // John
30
+ alert ( name ); // Іван
31
31
alert ( age ); // 30
32
32
alert ( isAdmin ); // false
33
33
```
Original file line number Diff line number Diff line change @@ -2,21 +2,21 @@ importance: 5
2
2
3
3
---
4
4
5
- # The maximal salary
5
+ # Максимальна зарплата
6
6
7
- There is a ` salaries ` object :
7
+ Є об’єкт ` salaries ` :
8
8
9
9
``` js
10
10
let salaries = {
11
- " John " : 100 ,
12
- " Pete " : 300 ,
13
- " Mary " : 250
11
+ " Іван " : 100 ,
12
+ " Петро " : 300 ,
13
+ " Марія " : 250
14
14
};
15
15
```
16
16
17
- Create the function ` topSalary(salaries) ` that returns the name of the top-paid person .
17
+ Створіть функцію ` topSalary(salaries) ` яка повертає ім’я найбільш високооплачуваної особи .
18
18
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
+ - Якщо є кілька високооплачуваних осіб, поверніть будь-якого з них .
21
21
22
- P.S. Use ` Object.entries ` and destructuring to iterate over key/value pairs .
22
+ P.S. Використовуйте ` Object.entries ` і деструктурування для перебору пар ключ/значення .
You can’t perform that action at this time.
0 commit comments