Skip to content

Commit b8bbc19

Browse files
committed
completed wesbos#4 Array.protoype.reduce()
1 parent 41473aa commit b8bbc19

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎04 - Array Cardio Day 1/index-START.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252

5353
// Array.prototype.reduce()
5454
// 4. How many years did all the inventors live?
55+
let yearsAllInventorsLived =
56+
inventors.reduce( (acc, curr) => acc + (curr.passed - curr.year), 0);
57+
console.log('All the years that all inventors lived: ',yearsAllInventorsLived);
5558

5659
// 5. Sort the inventors by years lived
5760

0 commit comments

Comments
 (0)