Question! How can I remove a specific element from this JavaScript object by its ID?
[
"{\"id\":\"b00a3a47-783a-4af5-90d9-59c4deb7a9e3\",\"notes\":\"sdfsdf\",\"recordType\":0}",
"{\"id\":\"a6f72972-502e-452b-9773-51699a527122\",\"notes\":\"sdfsfdf\",\"recordType\":0}"
]
I attempted the following code snippet:
var index = detailsArray.map(function (element) {
console.log("element = " + JSON.stringify(element) + " index = " + index + " id = " + element.id);
return element.id;
}).indexOf(detailId);
console.log("index of " + detailId + " = " + index);
delete detailsArray[index];
However, I encountered an issue where element.id was returned as undefined. I suspect this is due to the properties of the element being in string format. Any suggestions on how to fix this?