一,删除数组元素
let arr = [ {name:'黎明',id:21111}, {name:'王小二',id:1111}, {name:'大小二',id:3222} ] arr.splice(arr.findIndex(item => item.id === 3222), 1) arr.filter(obj=>obj.id!==3222)
二,删除对象元素
let arr = { name: '黎明', id: 1111, age: 24 }; 方法1: const personUnkonwAge = (({name, id}) => ({name,id}))(arr) console.log(personUnkonwAge) console.log(arr) 方法二: let {name, ...personUnknowName} = arr console.log(personUnknowName)