js删除数组指定元素
const person = [
{
id: 0,
name: 'zhangsan'
},
{
id: 1,
name: 'wangwu'
},
{
id: 2,
name: 'zhaoliu'
}
];
// 删除对象id为1的元素
person.splice(person.findIndex(item => item.id === 1),1);
console.log(person);
标签:name,删除,元素,js,person,数组,id
From: https://www.cnblogs.com/bingquan1/p/16772518.html