I would like to know how to remove particular key value pair in nested array object. But I need to get all the object. how to do in javascript.
In the below obj, remove the mon
key value pair and fetch the obj in javascript
var result = getObj(obj, "mon");
getObj(arr, month){
return arr.filter(element=>
if (element != month){
return element
}
);
}
var obj =[
{id: 1, mon: "Dec", tot: 1000},
{id: 2, mon: "tues", tot: 2000}
]
Expected Output:
[
{id: 1, tot: 1000},
{id: 2, tot: 2000}
]