how to delete element from array with splice code example
Example 1: how to delete element in list javascript
//using filter method
let itemsToBeRemoved = ["Sunday", "Monday"]
var filteredArray = myArray.filter(item => !itemsToBeRemoved.includes(item))
Example 2: remove id from array javascript
const drinks = ['Cola', 'Lemonade', 'Coffee', 'Water'];
const id = 2;
const removedDrink = drinks.splice(id, 1);