Skip to content

Commit 7a059b4

Browse files
committed
04 - Array Cardio Day 1: Answer wesbos#5
1 parent 469b59a commit 7a059b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262
console.log(years);
6363

6464
// 5. Sort the inventors by years lived
65+
const oldest = inventors.sort((a, b) => {
66+
const firstAge = a.passed - a.year
67+
const secondAge = b.passed - b.year
68+
return secondAge - firstAge
69+
})
70+
console.table(oldest)
6571

6672
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
6773
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris

0 commit comments

Comments
 (0)