-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
51 lines (43 loc) · 779 Bytes
/
index.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
47
48
49
50
51
student1 = {
name: "person 1",
id: 1,
grade: 11,
classes: ["math", "science"],
};
student2 = {
name: "person 2",
id: 2,
grade: 10,
classes: ["math", "science", "history", "english"],
};
student3 = {
name: "person 3",
id: 3,
grade: 9,
classes: ["science", "history"],
};
student4 = {
name: "person 4",
id: 4,
grade: 12,
classes: ["math", "science", "history"],
};
students = [student1, student2, student3, student4];
// Part 1
console.log('Part 1');
students.forEach((s) => {
console.log(s.name);
});
// Part 2
console.log('Part 2');
students.forEach((s) => {
console.log(s.classes);
});
// Part 3
console.log('Part 3');
filteredStudents = students.filter((s) => {
return s.grade > 10;
});
filteredStudents.forEach((s) => {
console.log(s);
});