Skip to content

Commit eed505b

Browse files
committed
Finished Day wesbos#4
1 parent d05f288 commit eed505b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,17 @@
5353
console.log(fullNames)
5454
// Array.prototype.sort()
5555
// 3. Sort the inventors by birthdate, oldest to youngest
56-
const ordered = inventors.sort()
56+
// const ordered = inventors.sort(function(a,b){
57+
// if(a.year > b.year) {
58+
// return 1;
59+
// }else{
60+
// return -1;
61+
// }
62+
// })
63+
64+
const ordered = inventors.sort((a,b) => a.year > b.year ? 1 : -1)
65+
66+
console.table(ordered)
5767
// Array.prototype.reduce()
5868
// 4. How many years did all the inventors live all together?
5969

0 commit comments

Comments
 (0)