Skip to content

Commit 6151e32

Browse files
committed
modified years lived sort to descending order
1 parent 05de275 commit 6151e32

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@
8383
console.log(totalYears);
8484

8585
// 5. Sort the inventors by years lived
86-
const ages = inventors.sort((a,b) => (a.passed-a.year > b.passed - b.year) ? 1:-1);
86+
const ages = inventors.sort((a,b) => (a.passed-a.year > b.passed - b.year) ? -1:1);
8787

8888
// refactored!
8989
// const ages = inventors.sort(function(a,b){
9090
// if (a.passed-a.year > b.passed-b.year){
91-
// return 1;
92-
// } else{
9391
// return -1;
92+
// } else{
93+
// return 1;
9494
// };
9595
// });
9696
console.table(ages);

0 commit comments

Comments
 (0)