Hi, I'm working on a map that contains key-value pairs. How can I remove multiple keysets from my map?
Here is the part where the map is created:
// The result key looks something like 0-119, 0-110, 0-118 for each entry
this.OptionsMap.set('' + result, selectedList[index]);
And here is the part where keys are deleted from the map:
const entriesd = JSON.parse(JSON.stringify(selectedList));
for (let [key, value] of Object.entries(entriesd)) {
if (value.key === 'AB') {
console.log('keys', value.index)
this.OptionsMap.delete('' + value.index);
}
}
The selectedList contains the following elements:
(3) [{…}, {…}, {…}]
0: {id: "101", value: "A1B", key: "AB", index: "0-119", …}
1: {id: "130", value: "130", key: "AB", index: "0-110", …}
2: {id: "130", value: "130", key: "AB", index: "0-118", …}
While I am able to retrieve the indices in my console.log as 0-119, 0-110, 0-118, I need assistance with removing multiple indices in the deletion process. Any suggestions would be greatly appreciated. Thank you in advance.