forked from juliejonak/JavaScript-Fundamentals-Review
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray-methods.js
More file actions
214 lines (197 loc) · 4.91 KB
/
array-methods.js
File metadata and controls
214 lines (197 loc) · 4.91 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// The array below is full of objects that represent different games.
//Complete the tasks by using the For Each, Map, Filter and Reduce methods
const games = [
{
id: 1,
name: 'Monopoly',
gameType: 'Board',
minPlayers: 2,
maxPlayers: 6,
difficulty: 'Medium',
inInventory: 6,
},
{
id: 2,
name: 'Chess',
gameType: 'Strategy',
minPlayers: 2,
maxPlayers: 2,
difficulty: 'Hard',
inInventory: 2,
},
{
id: 3,
name: 'Hearts',
gameType: 'Card',
minPlayers: 4,
maxPlayers: 8,
difficulty: 'Easy',
inInventory: 4,
},
{
id: 4,
name: 'War',
gameType: 'Card',
minPlayers: 2,
maxPlayers: 5,
difficulty: 'Easy',
inInventory: 9,
},
{
id: 5,
name: 'Risk',
gameType: 'Strategy',
minPlayers: 2,
maxPlayers: 6,
difficulty: 'Hard',
inInventory: 1,
},
{
id: 6,
name: 'Scrabble',
gameType: 'Word',
minPlayers: 1,
maxPlayers: 4,
difficulty: 'Medium',
inInventory: 7,
},
{
id: 7,
name: 'Boggle',
gameType: 'Word',
minPlayers: 1,
maxPlayers: 8,
difficulty: 'Easy',
inInventory: 6,
},
{
id: 8,
name: 'Clue',
gameType: 'Board',
minPlayers: 3,
maxPlayers: 6,
difficulty: 'Easy',
inInventory: 3,
},
{
id: 9,
name: 'Ticket to Ride',
gameType: 'Strategy',
minPlayers: 2,
maxPlayers: 6,
difficulty: 'Hard',
inInventory: 2,
},
{
id: 10,
name: 'Checkers',
gameType: 'Board',
minPlayers: 2,
maxPlayers: 2,
difficulty: 'Easy',
inInventory: 5,
},
{
id: 11,
name: 'Trivial Pursuit',
gameType: 'Trivia',
minPlayers: 2,
maxPlayers: 5,
difficulty: 'Hard',
inInventory: 1,
},
{
id: 12,
name: 'Mastermind',
gameType: 'Puzzle',
minPlayers: 2,
maxPlayers: 3,
difficulty: 'Medium',
inInventory: 8,
},
{
id: 13,
name: 'Settlers of Catan',
gameType: 'Strategy',
minPlayers: 2,
maxPlayers: 6,
difficulty: 'Medium',
inInventory: 4,
},
{
id: 14,
name: 'Slapjack',
gameType: 'Card',
minPlayers: 2,
maxPlayers: 4,
difficulty: 'Easy',
inInventory: 5,
},
{
id: 15,
name: 'The Game of Life',
gameType: 'Board',
minPlayers: 2,
maxPlayers: 6,
difficulty: 'Easy',
inInventory: 3,
},
{
id: 16,
name: 'Codenames',
gameType: 'Board',
minPlayers: 4,
maxPlayers: 8,
difficulty: 'Medium',
inInventory: 2,
},
{
id: 17,
name: 'Candy Land',
gameType: 'Board',
minPlayers: 2,
maxPlayers: 4,
difficulty: 'Easy',
inInventory: 7,
},
{
id: 18,
name: 'Carcassone',
gameType: 'Strategy',
minPlayers: 2,
maxPlayers: 5,
difficulty: 'Medium',
inInventory: 4,
},
{
id: 19,
name: 'Battleship',
gameType: 'Board',
minPlayers: 2,
maxPlayers: 2,
difficulty: 'Easy',
inInventory: 3,
},
{
id: 20,
name: 'Poker',
gameType: 'Card',
minPlayers: 4,
maxPlayers: 6,
difficulty: 'Medium',
inInventory: 6,
},
]
// **Question 1: A customer has come into the game shop and wants to view the card game section. Using ForEach,
//show the customer a list of all the card games
//**Question 2: The shop owner would like to create a booklet that tells the following for each game in his store:
// "Our store has GAMENAME, a TYPE game for MINPLAYERS to MAXPLAYERS players." Use Map to export that statement for
//each game.
//**Question 3: The shop owner would like to create 3 lists of games. Easy, medium and hard difficulty so
//customers can quickly find the level they're looking for. Use Filter to return three arrays sorted by difficulty
//**Question 4: A customer is hosting a party that will have 5 players in total. She would like a list of all the
//games that her group of friends could play, appropriate for 5 players. Return an array list of those games.
//**Question 5: A buyer for a neaby toy store wants to come in and purchase 5 of every Easy game, 3 of every Medium game
// and 2 of every Hard game. Using any method, return a statement for each game in inventory that says if there
//are enough of that game in inventory to fulfill the order, and how many of each game will be left after the
//order is fulfilled.