/**
array要去重的数组
key数组中的的唯一标识符

**/
uniqueArray(array, key){
let result = [array[0]];
for(let i = 1; i < array.length; i++){
let item = array[i];
let repeat = false;
for (let j = 0; j < result.length; j++) {
if (item[key] == result[j][key]) {
repeat = true;
break;
}
}
if (!repeat) {
result.push(item);
}
}
return result;
},

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-10-26
  • 2021-11-01
  • 2022-12-23
相关资源
相似解决方案