File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments