Skip to content

Commit fbe58ea

Browse files
committed
finished day 7 - array cardio wesbos#2
1 parent c5f1d60 commit fbe58ea

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,27 @@
2626

2727
// Some and Every Checks
2828
// Array.prototype.some() // is at least one person 19 or older?
29+
console.log(
30+
people.some(person => new Date().getFullYear() - person.year >= 19)
31+
)
2932
// Array.prototype.every() // is everyone 19 or older?
33+
console.log(
34+
people.every(person => new Date().getFullYear() - person.year >= 19)
35+
)
3036

3137
// Array.prototype.find()
3238
// Find is like filter, but instead returns just the one you are looking for
3339
// find the comment with the ID of 823423
40+
console.log(
41+
comments.find(comment => comment.id === 823423)
42+
)
3443

3544
// Array.prototype.findIndex()
3645
// Find the comment with this ID
3746
// delete the comment with the ID of 823423
47+
const index = comments.findIndex(comment => comment.id === 823423)
48+
comments.splice(index, 1);
49+
console.log(comments);
3850

3951
</script>
4052
</body>

0 commit comments

Comments
 (0)