если ваш словарь object
, вы можете удалить свойство объекта следующим образом:
// in case your dictionary is object:
const Dictionary = {
firstname: 'John',
lastname: 'Doe'
}
delete Dictionary['firstname']; // <-- Use your ID instead
console.log(Dictionary.firstname);
// expected output: undefined
// As in your comments you said your dictionary is like following:
//in case your dictionary is an Array
const Dictionary = [ ];
Dictionary.push({ key: PersonId , value: PersonDescription })
//in this case you can do this:
const newDictionary = Dictionary.filter(item => item.key !== id)
// newDictionary is an Array without the item with key === id
проверьте эту ссылку в детская площадка