Skip to content

Commit d05f288

Browse files
committed
Finished 1-3 of Day wesbos#4
1 parent 051c4a5 commit d05f288

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,23 @@
3737

3838
// Array.prototype.filter()
3939
// 1. Filter the list of inventors for those who were born in the 1500's
40+
constfiftenn=inventors.filter(inventor=>inventor.year>=1500&&inventor.year<1600)
41+
42+
43+
44+
// if(inventor.year >= 1500 && inventor.year < 1600){
45+
// return true; // keep it!
46+
// }
47+
48+
console.table(fiftenn);
4049

4150
// Array.prototype.map()
4251
// 2. Give us an array of the inventors first and last names
43-
52+
constfullNames=inventors.map(inventor=>`${inventor.first}${inventor.last}`);
53+
console.log(fullNames)
4454
// Array.prototype.sort()
4555
// 3. Sort the inventors by birthdate, oldest to youngest
46-
56+
constordered=inventors.sort()
4757
// Array.prototype.reduce()
4858
// 4. How many years did all the inventors live all together?
4959

0 commit comments

Comments
(0)