📌  相关文章
📜  使用两个参数过滤出数组中的对象 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:18.903000             🧑  作者: Mango

代码示例3
var arr= [{id: "123", name: "Foo"},
          {id: "123", name: "Bar"},
          {id: "345", name: "Foo"},
          {id: "678", name: "FooBar"}
         ];

var name = 'Foo';
var id = '123';

arr = arr.filter(function(elem) {
  //return false for the element that matches both the name and the id
  return !(elem.id == id && elem.name == name)
});