javascript push and delte item of array 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: exclude vales from array in js
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
var filtered = array.filter(function(value, index, arr){
return value > 5;
});
//array => [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
//filtered => [6, 7, 8, 9]