Skip to content

Commit e3d8285

Browse files
author
anirampling
committed
Added solution to wesbos#5.
1 parent a3f9b97 commit e3d8285

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@
6363
console.log(yearsLived)
6464

6565
// 5. Sort the inventors by years lived
66+
const oldest = inventors.sort(function(a, b) {
67+
const lastInventor = a.passed - a.year;
68+
const nextInventor = a.passed - b.year;
69+
return lastInventor > nextInventor ? -1: 1;
70+
})
71+
72+
console.table(oldest)
6673

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

7077

78+
7179
// 7. sort Exercise
7280
// Sort the people alphabetically by last name
7381

0 commit comments

Comments
 (0)