删除数组对象中的某一个对象

var list=[
     { title: 'A',name: 'A1' },
     { title: 'B' , name: 'B1'}
   ]
list.push({ title: 'C',name: 'C1'}) //往数组中push数据
console.log(list)
var newArr = list.filter(function (item) {
  return item.title.match(/A/)  //将数组中的某个对象去掉
})
console.log(newArr)//0: {title: "A", name: "A1"}
console.log(list)//[{ title: 'B' , name: 'B1'},{ title: 'C',name: 'C1'}]


posted @ 2019-10-23 19:44  guanqinghua  阅读(151)  评论(0编辑  收藏  举报