vararr=[{key:'01',value:'乐乐',id:001},{key:'02',value:'博博',id:002},{key:'03',value:'淘淘',id:003},{key:'04',value:'哈哈',id:004},{key:'01',value:'小明',id:005},{key:'03',value:'欢欢',id:006}];varnewArr=[{key:'01',list:[{value:'乐乐',id:001},{value:'小明',id:005}]},{key:'02',list:[{value:'博博',id:002}]},{key:'03',list:[{value:'淘淘',id:003},{value:'欢欢',id:006}]},{key:'04',list:[{value:'哈哈',id:004}]}];我要怎么样把arr去重后转换成newArr这种格式呢
相关分类