I have an array like this:
let arr = ['liverpool', 'arsenal', 'man utd', 'chelsea', 'tottenham', 'crystal palace', 'madrid', 'barcelona'];
and I want to remove items, let's say 'arsenal' and 'chelsea', but this needs to be dynamic.
I have tried the following, where items is an array but unfortunately it didn't work:
function removeItems(items) {
arr.filter(item => {
return !arr.includes(items)
});
}
removeItems(['arsenal', 'chelsea']);
filterreturns a new array, it doesn't modify the array you call it on. SoremoveItemwould need to return the result, and the call would have to assign the result to something.