摘要:
const arr = [ { id: 1, parent_id: null }, { id: 2, parent_id: 1 }, { id: 3, parent_id: 1 }, { id: 4, parent_id: 2 }, { id: 5, parent_id: 4 }, ] const 阅读全文
摘要:
const responseList = [ 1,2,2,4,5,6,1,5,3,6] console.log(uniqueBy(responseList,'a')); function uniqueBy(arr, key) { return arr.reduce((acc,cur)=>{ if ( 阅读全文