I want to filter through an array and retrieve items if their filters match. However it does not work.
const wanted=["apple"]
const items = [
{
"name": "Iphone"
"filters": ["phone","apple"]
},
{
"name": "samsung12"
"filters": ["samsung12","samsung"]
},
]
let desiredList = items.filter((val) => wanted.includes(val.filters));
Any ideas on how i could get this to work?
itemsis an array?includesmethod doesn't work like that. See documentation again.