1 parent 5e546bb commit 94b6cb5Copy full SHA for 94b6cb5
1 file changed
07 - Array Cardio Day 2/index.html
@@ -47,6 +47,19 @@
47
const commentId = comments.findIndex( comment => comment.id === 823423)
48
console.log({commentId})
49
50
+ // Delete element from array by id
51
+
52
+ // Popular Redux method
53
+ const newComments = [
54
+ ...comments.slice(0, commentId),
55
+ ...comments.slice(commentId + 1)
56
+ ]
57
+ console.table(newComments)
58
59
+ // And normal use splice
60
+ comments.splice(commentId, 1)
61
+ console.table(comments)
62
63
</script>
64
</body>
65
</html>
0 commit comments