I'm stuck with Array, objects and filters. I have the following code and I want to filter the (array)list with my filter settings. and then do something with it. I am using React as frame work. But i think this is pure Javascript.
Am I in the right direction?
filterSettings = { flagA: false, flagB: true, FlagC: true};
list = [
{flag: a, txt: 'some text1'},
{flag: a, txt: 'some text2'},
{flag: b, txt: 'some text3'},
{flag: b, txt: 'some text4'},
{flag: c, txt: 'some text5'},
{flag: c, txt: 'some text6'},
]
list.filter(
// if(filtersettings.a === true) show flags with a
//else{hide flags with a}
// if(filtersettings.b === true) show flags with b
//else{hide flags with b}
///...ect
).map((item)=>{
console.log(item);
});