Remove a specific item from an array in JavaScript

Today we’ll show you how to remove a specific item from an array in JavaScript. There are multiple ways to remove an element from an array using JavaScript.

You may check the few more articles related to the array.

Ways to remove a specific item from an array

  1. splice() method
  2. filter() method

1. splice() method

Here, In the first method, we will use the splice() method along with the indexOf() method. First, find the index of a specific item using the indexOf() method that you want to remove from an array. After that we have to remove that index using the splice() method.

2. filter() method

Using the filter() method, we can easily remove the items from the list. It’s most preferable method to remove an item.

Example 1

In the next example, we will see the array that contains the list of the object and remove the specific object from the list using the filter() method.

Example 2

That’s it for today.
Thank you for reading. Happy Coding..!!

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *