js过滤数组对象中重复的数据

//that.trackData 数据

const newArr = that.trackData.reduce(function (tempArr, item) {

if (tempArr.findIndex((ele) => (ele.lon === item.lon) && (ele.lat === item.lat)) === -1) {

tempArr.push(item)

}

return tempArr

}, [])

console.log(newArr.length,'newArr');