diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 760e920e03..aa41c94a6b 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -34,14 +34,37 @@ // Array.prototype.every() // is everyone 19 or older? + const ageCheck = people.every(person => + ((new Date()).getFullYear()) - person.year >= 19); + + let groupOk = '
Group is OK
'; + let groupNotOk = '
Group is not OK
'; + + /*verifyGroup = ageCheck ? document.getElementbyId("body").innerHTML = groupOk : document.getElementbyId("body").innerHTML = groupNotOk; + + document.body.appendChild(document.createTextNode(verifyGroup));*/ + + console.log(ageCheck); + // 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(comment => + comment.id === 823423 + ); + + console.log(comment); + // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const index = comments.findIndex(comment => + comment.id === 823423); + + comments.splice(index, 1); +