让我们说我有这个对象数组:
[{name: "John", age: "30"},
{name: "Jane", age: "20"}]
我可以根据键值对从该数组中删除一个对象吗?例如,删除名称为“ John”的对象?
答案 0 :(得分:1)
您可以拼接包含名称“ John”的对象
MainActivity
答案 1 :(得分:0)
您也可以使用reject
:
var people = [{name: "John", age: "30"},
{name: "Jane", age: "20"}]
people = people.reject(person => person.name === "John")