Skip to content

Commit 469b59a

Browse files
committed
04 - Array Cardio Day 1: Answer wesbos#4
1 parent 7218c63 commit 469b59a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555

5656
// Array.prototype.reduce()
5757
// 4. How many years did all the inventors live all together?
58+
const years = inventors.reduce((total, inventor) => {
59+
const age = inventor.passed - inventor.year
60+
return total + age
61+
}, 0)
62+
console.log(years);
5863

5964
// 5. Sort the inventors by years lived
6065

0 commit comments

Comments
 (0)