object array
{
first : { label :"a" , status : true , text: "dummy" },
second : { label :"b" , status : true , text: "dummy" },
third : { label :"c" , status : false , text: "dummy" }
}
I have the object and map and push inot other object check the object key have label is “c” ,if present then dont push
const newData = data && data.map(item => {
if(item.label !=='c') {
return {
...item,
};
}
});
expected result
{
first : { label :"a" , status : true , text: "dummy" },
second : { label :"b" , status : true , text: "dummy" }
}