Repository navigation
Expand file tree
/
Copy patharrays.js
More file actions
62 lines (51 loc) · 2.02 KB
/
Copy patharrays.js
File metadata and controls
62 lines (51 loc) · 2.02 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
/*
The Array truly is a beatiful thing.
For this mini assignment we're going to have you go through some of the commonly used array methods.
There are so many methods built onto the Array prototype so here is a refernce of where you can learn more about them.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
Array Methods you should use to complete these assignemnts:
.pop(), .push(), .splice(), .slice(), .shift(), .unshift(), .map() .filter(),
*/
/*
Problem 1: Justice League
Remove the side kick 'Robin' from the front of this List.
Add a super hero `Green Lantern` to the end of this List.
Add a super hero `Superman` to the front of this List.
Your final array should look like this:
[ 'Superman','Batman', 'Wonder Woman', 'Flash','Aquaman', 'Green Lantern' ]
*/
const justiceLeague = ['Robin', 'Batman', 'Wonder Woman', 'Flash', 'Aquaman'];
/*
Problem 2: Middle Earth
In our list of Characters from Middle Earth remove sauraman. He's a traitor.
*/
const middleEarth = ['Frodo', 'Samwise', 'Gandalf', 'Sauraman', 'Treebeard'];
/*
Problem 3: Numbers
map over this array, and return a new array of the numbers in it, multiplied by 10
*/
const numbers = [2, 3, 4, 5, 6];
const numsByTen = numbers; // finish this.
/*
Problem 4: Filter Friends
Here you're going to create two new arrays.
One called femaleFriends (a list of all friends filtered where gender === 'F')
One called maleFriends (a list of all friends filtered where gender === 'M')
*/
const friends = [
{ name: 'Monica', gender: 'F' },
{ name: 'Chandler', gender: 'M' },
{ name: 'Ross', gender: 'M' },
{ name: 'Phoebe', gender: 'F' },
{ name: 'Joey', gender: 'M' },
{ name: 'Rachel', gender: 'M' }
];
const femaleFriends = friends; // finish this
const male = friends; // finish this
module.exports = {
justiceLeague,
middleEarth,
numsByTen,
femaleFriends,
male
};