Skip to content

Commit 1f50dce

Browse files
author
laryl.li
committed
Solved wesbos#5 Sort the inventors by years lived
1 parent 3ecdfed commit 1f50dce

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
console.log(year);
6464

6565
// 5. Sort the inventors by years lived
66+
const sortedyearslived = inventors.sort(yearslived);
67+
function yearslived(a,b){
68+
return ((b.passed-b.year)-(a.passed-a.year));
69+
}
70+
console.log(sortedyearslived);
6671

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

0 commit comments

Comments
 (0)