From d99ccf70e1f1ea1fd95d2d42e9424712bbc02d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=20Mar=C3=A9chal?= Date: Wed, 4 Mar 2026 15:45:06 +0100 Subject: [PATCH 1/2] feat: create a fitler function by birth date --- 04 - Array Cardio Day 1/index-START.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 0dcfd00f40..6dd3343ccc 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -35,10 +35,23 @@ 'Berne, Eric', 'Berra, Yogi', 'Berry, Wendell', 'Bevan, Aneurin', 'Ben-Gurion, David', 'Bevel, Ken', 'Biden, Joseph', 'Bennington, Chester', 'Bierce, Ambrose', 'Billings, Josh', 'Birrell, Augustine', 'Blair, Tony', 'Beecher, Henry', 'Biondo, Frank' ]; + + // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + + function filterBday(array, yearTest) { + return array.filter(inventor => inventor.year < yearTest + 100 && inventor.year >= yearTest); + } + + let inventorsFrom1500 = filterBday(inventors, 1500); + console.log(inventorsFrom1500); + + let inventorsFrom1800 = filterBday(inventors, 1800); + console.log(inventorsFrom1800); + // Array.prototype.map() // 2. Give us an array of the inventors first and last names From 80b013c10b5c1b2602a1130c8434e2735fc366d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=20Mar=C3=A9chal?= Date: Wed, 4 Mar 2026 16:19:55 +0100 Subject: [PATCH 2/2] Second exercise completed --- 04 - Array Cardio Day 1/index-START.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 6dd3343ccc..1b65701396 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -47,14 +47,21 @@ } let inventorsFrom1500 = filterBday(inventors, 1500); - console.log(inventorsFrom1500); + // console.log(inventorsFrom1500); let inventorsFrom1800 = filterBday(inventors, 1800); - console.log(inventorsFrom1800); + // console.log(inventorsFrom1800); // Array.prototype.map() // 2. Give us an array of the inventors first and last names + function firstLast (array) { + return array.map(inventor => `${inventor.first} ${inventor.last}`); + } + + let inventorsNames = firstLast(inventors); + console.log(inventorsNames); + // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest