Skip to content

Commit 797f144

Browse files
committed
finish array-methods free form challenges
1 parent 8ca70c3 commit 797f144

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎assignments/array-methods.js‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,15 @@ console.log(totalDonations);
8181
// 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.
8282

8383
// Problem 1
84-
84+
// The CHUMPS who donated less than $100 dollars won't be receiving a free water bottle. Get a list of those Scrooges and DISQUALIFY THEM!!!
85+
const cheapSkates = runners.filter((runner) => {return runner.donation < 100});
86+
console.log(cheapSkates);
8587
// Problem 2
86-
87-
// Problem 3
88+
// We'd like to know which company's employees are donating the most money, but we'd like to keep donor's names anonymous. Create an array listing company name and donation amount.
89+
let companyDonorArray = [];
90+
runners.forEach((runner) => {companyDonorArray.push(`runner.company_name, runner.donation`)});
91+
console.log(companyDonorArray);
92+
// Problem 3
93+
// Students are getting a discount! Return an array of objects representing the students
94+
const students = runners.filter((runner) => {return runner.email.endsWith('edu')});
95+
console.log(students);

0 commit comments

Comments
 (0)