Skip to content

Commit d6e7ed5

Browse files
committed
add challenge 4 array-methods
1 parent 0154641 commit d6e7ed5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

assignments/array-methods.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ console.log(largeShirts);
8484

8585
// ==== Challenge 4: Use .reduce() ====
8686
// 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
87-
let ticketPriceTotal = [];
87+
// let ticketPriceTotal = [];
88+
89+
const ticketPriceTotal = runners.reduce(function (total, amount) {
90+
return total + amount.donation
91+
},0);
8892
console.log(ticketPriceTotal);
8993

9094
// ==== Challenge 5: Be Creative ====

0 commit comments

Comments
 (0)