我想从对象数组中删除特定对象。数组如下
data_list = [
{
{
name: "george",
age : 20,
address: "new york"
},
{
name: "mavan",
age : 23,
address: "new york"
},
{
name: "chris",
age : 25,
address: "melborn"
},
{
name: "jerry",
age : 26,
address: "dubai"
}
}
]
我想通过考虑name属性来删除关注对象。即chirs
{
name: "chris",
age : 25,
address: "melborn"
},
我应该怎么做
答案 0 :(得分:1)
data_list = data_list.filter(obj => obj.name !== 'chris')