-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
46 lines (34 loc) · 950 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
let chosen = 1;
let myFriends = [
{ title: "Osama", age: 39, available: true, skills: ["HTML", "CSS"] },
{ title: "Ahmed", age: 25, available: false, skills: ["Python", "Django"] },
{ title: "Sayed", age: 33, available: true, skills: ["PHP", "Laravel"] },
];
// Write Your Code Here
const [personOne, personTwo, personThree] = myFriends;
let title, age, available, skill2;
if (chosen === 1) {
({ title, age, available, skills: [, skill2] } = personOne);
} else if (chosen === 2) {
({ title, age, available, skills: [, skill2] } = personTwo);
} else if (chosen === 3) {
({ title, age, available, skills: [, skill2] } = personThree);
}
console.log(title);
console.log(age);
console.log(available ? "Available" : "Not available");
console.log(skill2);
// "Osama"
// 39
// "Available"
// "CSS"
// // If chosen === 2
// "Ahmed"
// 25
// "Not Available"
// "Django"
// // If chosen === 3
// "Sayed"
// 33
// "Available"
// "Laravel"