Skip to content

Commit c9a7859

Browse files
author
mparedes003
committed
completed array-methods.js Challenge 5
1 parent d854deb commit c9a7859

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

assignments/array-methods.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,36 @@ console.log(ticketPriceTotal);
9191
// 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 solve 3 unique problems using one or many of the array methods listed above.
9292

9393
// Problem 1
94+
//The event director needs the first names and last names
95+
// of each runner along with their email addresses for creating a
96+
// contact list for the runners be able to coordinate with each other.
97+
// Combine both the first and last names into a new array called contactList along with their email addresses.
98+
let contactList = [];
99+
100+
runners.forEach(function(element) {
101+
contactList.push(element.first_name + " " + element.last_name + " " + element.email)
102+
});
103+
104+
console.log(contactList);
105+
94106

95107
// Problem 2
108+
// The event director needs the list of runners that donated $200 and up so that she knows who to send special gift cards to.
109+
// Get a list of runners that donated $200 and up so they know who to send the special gift cards to. Return an array named twoHundredUp
110+
// that contains information about the runners that donated $200 and up and log the result
111+
let twoHundredUp = runners.filter((data) => {
112+
return data.donation >= 200;
113+
});
114+
115+
console.log(twoHundredUp);
116+
117+
// Problem 3
118+
// The event director needs to have all the runner's first names converted to uppercase because they need to print place cards for
119+
// an event and would like all runner working at the same companys to sit together. They would like the company names to be printed in all caps
120+
// so the runners can see the labels clearly and are easily read. Get the list of companies and render them in uppercase.
121+
// Return an array named companiesInCaps that contains the information needed and log the result.
122+
const companiesInCaps = runners.map(function(item) {
123+
return item.company_name.toUpperCase();
124+
});
96125

97-
// Problem 3
126+
console.log(companiesInCaps);

0 commit comments

Comments
 (0)