Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds function for first exercise of exercise #4
  • Loading branch information
dustinleer committed Oct 12, 2018
commit afb418fcfb06706a643b5968377f366ddd5c09bf
11 changes: 11 additions & 0 deletions 04 - Array Cardio Day 1/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ const people = ['Beck, Glenn', 'Becker, Carl', 'Beckett, Samuel', 'Beddoes, Mick

// Array.prototype.filter()
// 1. Filter the list of inventors for those who were born in the 1500's
/* const fifteen = inventors.filter(function(inventor) {
if (inventor.year >= 1500 && inventor.year <= 1599) {
return true; // keep it
}
}); */

/**********************************************
* ️️️☝️ Consolidating the above function ☝️
*********************************************/
const fifteen = inventors.filter(inventor => inventor.year >= 1500 && inventor.year <= 1599);
console.table(fifteen);

// Array.prototype.map()
// 2. Give us an array of the inventors' first and last names
Expand Down