Is there a way to remove specific date keys from multiple objects in an array of objects?
I attempted to use a for loop and the delete function, but it doesn't seem to be working.
var data = matchScoreData.tbl_FallOfWicket;
matchScoreData.tbl_FallOfWicket.forEach(element => {
if (matchScoreData.tbl_FallOfWicket.hasOwnProperty("createdDate")) {
delete ["createdDate"];
}
});
console.table(data);
var matchScoreData = {
"tbl_FallOfWicket": [
{
"pk_fallWicketID": 119,
"fk_matchID": 133137,
"fk_teamID": 141065,
"fk_dismissTypeID": 3,
"fk_dismissPlayerID": 969155,
"run": 40,
"wicket": 1,
"over": "5.1",
"inning": 1,
"createdDate": "2018-08-18T03:06:12+0000",
"modifiedDate": "",
},
{
"pk_fallWicketID": 120,
"fk_matchID": 133137,
"fk_teamID": 141065,
"fk_dismissTypeID": 1,
"fk_dismissPlayerID": 939721,
"run": 88,
"wicket": 2,
"over": "9.5",
"createdDate": "2018-08-18T03:06:12+0000",
"modifiedDate": "",
"inning": 1
}
]};
The output remains unchanged despite attempts to delete the date keys.