Skip to content

Commit 1dcedd3

Browse files
committed
Added wesbos#2 array of inventors & wesbos#3 sorted by birthdate
1 parent dc93584 commit 1dcedd3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,15 @@
8181

8282
// Array.prototype.map()
8383
// 2. Give us an array of the inventors first and last names
84+
const inventorArray = inventors.map(
85+
(inventor) => inventor.first + " " + inventor.last
86+
);
87+
console.table(inventorArray);
8488

8589
// Array.prototype.sort()
8690
// 3. Sort the inventors by birthdate, oldest to youngest
91+
const sortedBirthdate = inventors.sort((a, b) => a.year - b.year);
92+
console.table(sortedBirthdate);
8793

8894
// Array.prototype.reduce()
8995
// 4. How many years did all the inventors live all together?

0 commit comments

Comments
 (0)