输入是[{a:1,b:'ssss',c:'',d:''},{a:1,b:'ssswwdasgw',c:'',d:''},{a:2,b:'sssdfyhwww',c:'',d:''},{a:3,b:'ssswjkww',c:'',d:''}]
需要转化成:[[{a:1,b:'ssss',c:'',d:''},{a:1,b:'ssswwdasgw',c:'',d:''}],[{a:2,b:'sssdfyhwww',c:'',d:''}],[{a:3,b:'ssswjkww',c:'',d:''}]]
就是根据 a
的值来对数组进一步分组。
目前想到的就是先弄个数组存a的数值,去重复,再根据这个数组去筛选,想知道有什么好一点的方法