You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The event director needs both the first and last names of each runner for their running bibs. Combine both the first and last names into a new array called fullName.
58
-
letfullName=[];
58
+
59
+
/*
60
+
the following code is inspired by the MDN example on forEach() and populating
// The event director needs to have all the runner's first names converted to uppercase because the director BECAME DRUNK WITH POWER. Convert each first name into all caps and log the result
63
-
letallCaps=[];
79
+
letallCaps=runners.map(runner=>{
80
+
returnrunner.first_name.toUpperCase();
81
+
});
64
82
console.log(allCaps);
65
83
66
84
// ==== Challenge 3: Use .filter() ====
67
85
// The large shirts won't be available for the event due to an ordering issue. Get a list of runners with large sized shirts so they can choose a different size. Return an array named largeShirts that contains information about the runners that have a shirt size of L and log the result
68
-
letlargeShirts=[];
86
+
letlargeShirts=runners.filter(runner=>{
87
+
returnrunner.shirt_size=='L';
88
+
});
69
89
console.log(largeShirts);
70
90
71
91
// ==== Challenge 4: Use .reduce() ====
72
92
// The donations need to be tallied up and reported for tax purposes. Add up all the donations into a ticketPriceTotal array and log the result
// Now that you have used .forEach(), .map(), .filter(), and .reduce(). I want you to think of potential problems you could solve given the data set and the 5k fun run theme. Try to create and then solve 3 unique problems using one or many of the array methods listed above.
78
101
79
102
// Problem 1
103
+
// Getting the name and contact information of the largest doners. For now above 100 dollars.
0 commit comments