I'm trying to remove/ or splice objects from an array on the condition of a property. if the property string includes a string then remove that object from the array. So filter an object based on its property looping through an array of string.
I have a object like so
let obj = [
{
"name": "product one"
},
{
"name": "product two"
},
{
"name": "item one"
},
{
"name": "item three"
}
]
an array
let arr = ['one', 'item']
So i would like my final or return object to look like
[
{
name: "product two"
}
]
I've tried for loops, double for loops, filters, and include and all fail. One thing to note is my json file that i'm importing has over 20,000 records, so idk if thats a reason it might be failing.
var intersection = obj.filter(function (e) {
for (const word of arr) {
return !e.name.includes(word)
}
});