Skip to content

Commit 7ccfd67

Browse files
committed
solved problem wesbos#5
1 parent 7608b21 commit 7ccfd67

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,16 @@
6060
console.table(totalYears);
6161

6262
// 5. Sort the inventors by years lived
63+
const yearsLived = inventors.sort((a, b) => {
64+
const aLived = a.passed - a.year;
65+
const bLived = b.passed - b.year;
66+
return bLived - aLived;
67+
});
68+
console.table(yearsLived);
6369

6470
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
6571
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
66-
72+
6773

6874
// 7. sort Exercise
6975
// Sort the people alphabetically by last name

0 commit comments

Comments
 (0)