Skip to content

Commit abf7460

Browse files
sagun-macsagun-mac
authored andcommitted
Completed wesbos#4 added years lived in total
1 parent 1dcedd3 commit abf7460

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@
9393

9494
// Array.prototype.reduce()
9595
// 4. How many years did all the inventors live all together?
96-
96+
const totalYear = inventors.reduce((pre, cur) => {
97+
return pre + (cur.passed - cur.year);
98+
}, 0);
99+
console.log(totalYear);
97100
// 5. Sort the inventors by years lived
98101

99102
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name

0 commit comments

Comments
 (0)