我已经在第一列排序了 2D Javascript 数组
var arr = [[12.485019620906078, 236.90974767017053|166.7059999999991|244.15878139435978|156.54100000000025],
[12.735148445872, 238.038907254076|203.3000000000006|245.7107245706185|213.46500000000034],
[47.15778769718685, 238.038907254076|203.3000000000006|244.15878139435978|156.54100000000025],
[47.580051233708595, 236.90974767017053|166.7059999999991|245.7107245706185|213.46500000000034]
];
我正在尝试根据数组的 [i][1] 部分中的最后两个值删除重复项
244.15878139435978|156.54100000000025
245.7107245706185|213.46500000000034
使用以下未提供正确输出的功能
function remDupes(arr)
{
for(var i=0; i<arr.length-1; i++)
{
var i1 = arr[i][1].split("|");
var item1 = i1[2]+"|"+i1[3];
for(var j=i+1; j<arr.length; j++)
{
var i2 = arr[j][1].split("|");
var item2 = i2[2]+"|"+i2[3];
if(item1 == item2)
{
arr.splice(j,1);
}
}
}
return arr;
}
我正在寻找这样的最终数组。
[
[12.485019620906078, 236.90974767017053|166.7059999999991|244.15878139435978|156.54100000000025],
[12.735148445872, 238.038907254076|203.3000000000006|245.7107245706185|213.46500000000034]
]