From 097a735c4b582f5f45a8556a81fa3813cce2544c Mon Sep 17 00:00:00 2001 From: ASAP Date: Fri, 27 Oct 2017 18:29:34 -0400 Subject: [PATCH] Day 07 Compmlete --- 07 - Array Cardio Day 2/index-START.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..5fd52f1805 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,25 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? + const isAdult = people.some(person => ((new Date()).getFullYear()) - person.year >= 19); + console.log("Any adults?", isAdult); + // Array.prototype.every() // is everyone 19 or older? + const allAdults = people.every(person => ((new Date()).getFullYear()) - person.year >= 19); + console.log("All adults?", allAdults); // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 + const comment = comments.find(c => c.id === 823423); + console.log("Comment 823423", comment); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const purgeIndex = comments.findIndex(c => c.id === 823423); + comments.splice(purgeIndex, 1); + console.log("purge 823423", comments);