Hey there, I'm just starting out with react native and I have an array of objects. My goal is to remove an inner object from this JSON data.
[
{
Key: 1,
exchnageArr: [
{
name: ”FX”
},
{
name: ”MK”
}
]
},
{
Key: 2,
exchnageArr: [
{
name: ”CK”
},
{
name: ”DK”
}
]
}
]
I need to get rid of the {name:"FX"} entry in this JSON data by passing "FX". Unfortunately, my attempted solution hasn't been successful. Can someone help me figure out how to do this?
const newDatavalues = arr.forEach((item) =>
item.exchangeArr.forEach((subItem, index) => {
if (subItem.name === "FX") {
return item.exchangeArr.splice(index, 1);
}
})
);