-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise5.js
More file actions
50 lines (40 loc) · 1.05 KB
/
exercise5.js
File metadata and controls
50 lines (40 loc) · 1.05 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
// Complete the below questions using this array:
const array = [
{
username: "john",
team: "red",
score: 5,
items: ["ball", "book", "pen"]
},
{
username: "becky",
team: "blue",
score: 10,
items: ["tape", "backpack", "pen"]
},
{
username: "susy",
team: "red",
score: 55,
items: ["ball", "eraser", "pen"]
},
{
username: "tyson",
team: "green",
score: 1,
items: ["book", "pen"]
},
];
//Create an array using forEach that has all the usernames with a "!" to each of the usernames
//Create an array using map that has all the usernames with a "? to each of the usernames
//Filter the array to only include users who are on team: red
//Find out the total score of all users using reduce
// (1), what is the value of i?
// (2), Make this map function pure:
const arrayNum = [1, 2, 4, 5, 8, 9];
const newArray = arrayNum.map((num, i) => {
console.log(num, i);
alert(num);
return num * 2;
})
//BONUS: create a new list with all user information, but add "!" to the end of each items they own.