直接上代码
let userInfoLS=[ {id:1,name:'aaa'}, {id:2,name:'bbb'}, {id:3,name:'ccc'}, {id:2,name:'ddd'}, {id:1,name:'eee'}, {id:4,name:'ggg'} ] function deletArr(userInfoLS, id) { let list = [...userInfoLS]; let result = []; let obj = {}; for (let i = 0; i < list.length; i++) { if (!obj[list[i][id]]) { result.push(list[i]); obj[list[i].id] = true; } } return result; } //调用 userInfoLS = deletArr(userInfoLS, "id");