-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray-api3.js
More file actions
66 lines (55 loc) · 1.18 KB
/
array-api3.js
File metadata and controls
66 lines (55 loc) · 1.18 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
// Q1. make a string out of an array
{
const fruits = ['apple', 'banana', 'orange'];
}
// Q2. make an array out of a string
{
const fruits = '🍎, 🥝, 🍌, 🍒';
}
// Q3. make this array look like this: [5, 4, 3, 2, 1]
{
const array = [1, 2, 3, 4, 5];
}
// Q4. make new array without the first two elements
{
const array = [1, 2, 3, 4, 5];
}
class Student {
constructor(name, age, enrolled, score) {
this.name = name;
this.age = age;
this.enrolled = enrolled;
this.score = score;
}
}
const students = [
new Student('A', 29, true, 45),
new Student('B', 28, false, 80),
new Student('C', 30, true, 90),
new Student('D', 40, false, 66),
new Student('E', 18, true, 88),
];
// Q5. find a student with the score 90
{
}
// Q6. make an array of enrolled students
{
}
// Q7. make an array containing only the students' scores
// result should be: [45, 80, 90, 66, 88]
{
}
// Q8. check if there is a student with the score lower than 50
{
}
// Q9. compute students' average score
{
}
// Q10. make a string containing all the scores
// result should be: '45, 80, 90, 66, 88'
{
}
// Bonus! do Q10 sorted in ascending order
// result should be: '45, 66, 80, 88, 90'
{
}