I am working with two arrays of data:
checked: [
'orange', 'apple', 'juice'
]
and the second array:
products: [
'0': {
title: 'this is product title',
categories: [
'apple', 'juice'
]
}
]
I am trying to filter the data using a computed property with a checkbox.
Here is what I have tried so far:
computed: {
filterProducts(){
return this.products.filter(product => this.checked.includes(product.categories));
}
}
However, the filter is not working as expected. Can anyone provide guidance on how to make this work?