Skip to content

Commit 37ce42a

Browse files
array methods js three make up problems
1 parent 0f08798 commit 37ce42a

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎assignments/array-methods.js‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,23 @@ console.log(ticketPriceTotal);
8888
// 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.
8989

9090
// Problem 1
91-
91+
let highDoners = [];
92+
highDoners = runners.filter(runner => {
93+
return runner.donation > 100
94+
});
95+
console.log(highDoners);
96+
//{"id":50,"first_name":"Shell","last_name":"Baine","email":"sbaine1d@intel.com","shirt_size":"M","company_name":"Gabtype","donation":171}];
9297
// Problem 2
98+
let intelRunners = [];
99+
intelRunners = runners.filter( runner => {
100+
return runner.email.includes("intel");
101+
});
102+
console.log(intelRunners);
103+
104+
// Problem 3
93105

94-
// Problem 3
106+
let predictedDonation = [];
107+
predictedDonation = runners.reduce((accum, runner) => {
108+
return accum + (runner.donation + 50);
109+
}, 0);
110+
console.log(predictedDonation);

0 commit comments

Comments
 (0)