Skip to content

Commit d664c48

Browse files
committed
Update find methods
1 parent 7af96b5 commit d664c48

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
// Array.prototype.find()
3737
// Find is like filter, but instead returns just the one you are looking for
3838
// find the comment with the ID of 823423
39+
console.table(comments.find((it) => it.id == 823423))
3940

40-
4141
// Array.prototype.findIndex()
4242
// Find the comment with this ID
4343
// delete the comment with the ID of 823423
44-
44+
let index = comments.findIndex((it) => it.id == 823423)
45+
comments.splice(index, 1)
46+
console.table(comments)
4547
</script>
4648
</body>
4749
</html>

0 commit comments

Comments
 (0)