var listToDelete = [\'abc\', \'efg\']; var arrayOfObjects = [{id:\'abc\',name:\'oh\'}, // delete me {id:\'efg\',name:\'em\'}, // delete me
You can use filter. This method always returns the element if the condition is true. So if you want to remove by id you must keep all the element that doesn't match with the given id. Here is an example:
filter
arrayOfObjects = arrayOfObjects.filter(obj => obj.id != idToRemove)