Filter Array with objects based on another array dynamically.
I need to filter a main array using another array. But the filter array will only contain a few fields or several.
var codes = [{
"title": "lore",
"city": "New York",
"desc": "lorem lorem",
"age": "32"
},
{
"title": "lore2 ",
"city": "Santa Monica",
"desc": "lorem2",
"age": "20"
}
];
let filter = [{
"city": "New York"
}, {
"age": "20"
},
...Or more filters. This filter is dynamically created by the person clicking on the checkbox.
]
filteran array ? making it object makes more sense. no ?