Advertisement
Virajsinh

Multiple Array Object To Remove Item in JavaScript

Feb 16th, 2022
1,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://stackoverflow.com/questions/62447641/delete-multiple-objects-in-an-array-by-id
  2.  
  3. let id = 2;
  4. let list = [{
  5.   Id: 1,
  6.   Name: 'a'
  7. }, {
  8.   Id: 2,
  9.   Name: 'b'
  10. }, {
  11.   Id: 3,
  12.   Name: 'c'
  13. }];
  14. let lists = list.filter(x => {
  15.   return x.Id != id;
  16. })
  17. console.log(lists);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement