I have the below object, and want to remove the element("virAddrSeq": "345").
var state={
"todos": [
{
"accountNo": "50190000",
"name": "Sarkar",
"vpainfo": [
{
"virAddrSeq": "345"
},
{
"virAddrSeq": "34775"
}
]
}
]
}
I have tried the below way but getting all the records with out removing the element.
const newObj = Object.assign({}, state, {
todos: state.todos.filter(todoObj => (todoObj.vpainfo.filter(({virAddrSeq}) => (virAddrSeq != "345"))))
})
console.log(newObj)