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

var items=[
     { message: 'Foo',name: 'sss' },
     { message: 'Bar' , name: 'aaa'}
   ]
items.push({ message: 'Baz' , name:'djsaj'})
console.log(items)
var newArr = items.filter(function (item) {
  return item.message.match(/Foo/)
})
console.log(newArr)//0: {message: "Foo", name: "sss"}
console.log(items)

你可能感兴趣的:(js常用方法总结)