You can remove items from an array by using the filter function by giving the desire value comparing the difference
const array = [1, 2, 3, 4, 5] // Let's remove 3 console.log(array.filter((item) => item !== 3)) // [1, 2, 4, 5]
Yeah but this is a O(n) complexity, array.length = whatever is O(1) :)
Unless we're talking about two different things ofc 😂
Some comments have been hidden by the post's author - find out more
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can remove items from an array by using the filter function by giving the desire value comparing the difference
Yeah but this is a O(n) complexity, array.length = whatever is O(1) :)
Unless we're talking about two different things ofc 😂