-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise-6.js
More file actions
103 lines (86 loc) · 2.33 KB
/
exercise-6.js
File metadata and controls
103 lines (86 loc) · 2.33 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* Challenge Mentors
Write all your code at the end of the file
1. Loop through the array, and for each object, `console.log()` out the sentence only for
mentors that are in Barcelona and one of the skills is React
"Hi, my name is {firstName} {lastName}. I work in Barcelona and i know React."
2. To those that work in Barcelona, set "Jun1" in the class attribute,
and add a new skill to the list "SQL".
To add elements in an array you can use .push()
var animals = ["dog","cat"];
animals.push("horse"); //["dog","cat","horse"]
let sequence = [1, 2, 3];
sequence.push(4);
sequence.push(5);
console.log(sequence);
// → [1, 2, 3, 4, 5]
3. Create an object method with the name .addSkill() to be able to add skills from it
4. Create a function to add a skill to all members in a list of mentors
function addSkill(mentors,newSkill){
//your code here
}
5. Create a function to remove a skill to all members in a list of mentors
function removeSkill(mentors,newSkill){
//your code here
}
6. Create a function mentorWithMoreSkills() that returns the name of the mentor with more number of skills
7. Create an object method .addStudentLikes() that increments by one the attribute studentLikes
8. Create a function that adds a student like to all mentors in the array
function addStudentLikes(mentors){
//your code here
}
*/
var mentors = [
{
firstName: "Antonio",
lastName: "Miranda",
skills: ["JS","React","Node"],
class: "Mar1",
studentLikes: 0,
job:
{
company: "Google",
position: "Senior developer",
city: "Barcelona"
}
},
{
firstName: "Leo",
lastName: "Messi",
skills: ["Play football"],
class: "Mar3",
studentLikes: 0,
job:
{
company: "FC Barcelona",
position: "Player",
city: "Barcelona"
}
},
{
firstName: "John",
lastName: "VanDamme",
skills: ["React","Angular","Python","Node"],
class: "Mar4",
studentLikes: 0,
job:
{
company: "Facebook",
position: "Software Manager",
city: "Chicago"
}
},
{
firstName: "Giorgio",
lastName: "Polvara",
skills: ["HTML","JS","React"],
class: "Mar2",
studentLikes: 0,
job:
{
company: "Amazon",
position: "Senior developer",
city: "Barcelona"
}
},
];
//YOUR CODE HERE