I have this array of objects:
const parks = [
{
"properties": {
"name": "Park 1",
"parking": "",
"type": "park",
"picnic_area": 1
},
},
{
"properties": {
"name": "Park 2",
"parking": 1,
"type": "park",
"picnic_area": ""
},
}
];
The page have a list of checkboxes. When user check/uncheck one of then, a function generate an object with all the selected checkboxes:
{
"parking": true,
"picnic_area": true
}
My question is: how can I use this object to generate the conditions inside a filter()
function? Something like:
const parksData = parks.filter(object => {
return object_condition_1 && object_condition_2;
});
Via Active questions tagged javascript - Stack Overflow https://ift.tt/SHV0ArW
Comments
Post a Comment