Skip to content

Commit 8bccf2a

Browse files
committed
Finnish Array Cardio day 2
1 parent f871145 commit 8bccf2a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

07 - Array Cardio Day 2/index-START.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@
2727

2828
// Some and Every Checks
2929
// Array.prototype.some() // is at least one person 19 or older?
30+
console.log(people.some(person => new Date().getFullYear() - person.year >= 19));
3031
// Array.prototype.every() // is everyone 19 or older?
32+
console.log(people.every(person => new Date().getFullYear() - person.year >= 19));
3133

3234
// Array.prototype.find()
3335
// Find is like filter, but instead returns just the one you are looking for
3436
// find the comment with the ID of 823423
37+
const comment1 = comments.find(comment => comment.id === 823423);
38+
console.log(comment1);
3539

3640
// Array.prototype.findIndex()
3741
// Find the comment with this ID
3842
// delete the comment with the ID of 823423
39-
43+
const commentIndex = comments.findIndex(comment => comment.id === 823423);
44+
console.log(commentIndex);
45+
comments.splice(commentIndex, 1);
46+
console.table(comments);
4047
</script>
4148
</body>
4249
</html>

0 commit comments

Comments
 (0)