var arr=[{group:'我',return:false},{group:'我',return:false},{group:'2',return:false},{group:'2',return:false},{group:'4',return:false},{group:'4',return:false}];
var obj={};
arr.forEach((item) => {
if (!obj[item.group]) {
obj[item.group]=[]
}
obj[item.group].push(item)
});
console.log(obj)
屏幕快照 2021-03-22 16.51.53.png
网友评论