let msgLists = that.msgList.concat(msgObj);
that.msgList = msgLists.reduce(function (tempArr, item) {
if (tempArr.findIndex((ele) => ele.chatId === item.chatId) === -1) {
tempArr.push(item)
}
return tempArr
}, [])
let msgLists = that.msgList.concat(msgObj);
that.msgList = msgLists.reduce(function (tempArr, item) {
if (tempArr.findIndex((ele) => ele.chatId === item.chatId) === -1) {
tempArr.push(item)
}
return tempArr
}, [])
本文标题:js 根据chatId 删除数组重复元素
本文链接:https://www.haomeiwen.com/subject/ulyuirtx.html
网友评论