I have an array like this :
const appoint =[
{ a: "asas",
b:{au: false, h:false,l:true}
},
{ a: "avd",
b:{au: true, h:false,l:true}
},
{ a: "as", b:{au: true, h:false,l:false}
}];
When I access b , I want to filter the falsy values, so far I'm not successful doing it with a serie of map() like this :
const result = appoint.map(elem => elem.b.)
const finalresult = result.map(
item =>item.filter(
(item, value)=> item[value] === false )
)
elem.b.<-- is the last point a typo?... Anyway, you can't applyfilteron an object. What is the expected output format?falseas value, from the related objects? Or create a new object, that has all properties, except for the ones withfalseas value? As a note, imho, the namefinalresultis not good, if the previous one is not at leastintermediateresult. Next, you'll add afinalfinalresultor anendresult, and readability only goes downhill here.