I have the following array of objects, I want to loop through it and filter based on the id or code that I pass into the function.
state.products = [{id = 1, name = Bottle},{id = 2, name = umbrella}, {id = 3, name = shoe}]
const getVal = (id)=> {
const av = state.products.filter((s) s.productId == id)
}
The following doesn't seem to iterate through the array and check through each object? I am getting an empty array for console.log(av)