Skip to content

Commit faeca12

Browse files
committed
finish
1 parent a23f7ec commit faeca12

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,24 @@
3939
// Array.prototype.filter()
4040
// 1. Filter the list of inventors for those who were born in the 1500's
4141

42+
const inventorsXVI = inventors.filter(inventor => inventor.year >= 1500 && inventor.year < 1600);
43+
console.log(inventorsXVI);
44+
4245
// Array.prototype.map()
4346
// 2. Give us an array of the inventors first and last names
4447

48+
const fullNames = inventors.map(inventor => `${inventor.first} ${inventor.last}`);
49+
console.log(fullNames);
4550
// Array.prototype.sort()
4651
// 3. Sort the inventors by birthdate, oldest to youngest
4752

53+
4854
// Array.prototype.reduce()
4955
// 4. How many years did all the inventors live all together?
5056

57+
const aniosTotal = inventors.reduce((acumulador, inventor) => acumulador + (inventor.passed - inventor.year), 0);
58+
console.log(aniosTotal);
59+
5160
// 5. Sort the inventors by years lived
5261

5362
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name

0 commit comments

Comments
 (0)