Skip to content

Commit 4681446

Browse files
committed
Order by oldest man
1 parent f3763bf commit 4681446

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@
5353

5454
// 5. Sort the inventors by years lived
5555

56+
const ordLived = inventors.sort(function (a,b) {
57+
const lastGuy = a.passed - a.year;
58+
const nextGuy = b.passed - b.year;
59+
60+
return lastGuy > nextGuy ? -1 : 1;
61+
62+
});
63+
64+
console.table(ordLived);
65+
5666
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
5767
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
5868

0 commit comments

Comments
 (0)