let arr = [ { createTime: "2020-10-16", imgPath:"http://1.jpg" },{ createTime: "2020-10-16", imgPath:"2.jpg" },{ createTime: "2020-10-17", imgPath:"3.jpg" },{ createTime: "2020-10-17", imgPath:"4.jpg" }, ] function newFn(data){ let arr = data; let obj = {} let result = []; for(let i = 0; i < arr.length; i++){ if(!obj[arr[i].createTime]){ result.push({createTime:arr[i].createTime,imgPath:[]}) obj[arr[i].createTime] = arr[i].createTime } } return result; } function dealRes(data){ for(let item of arr){ for(let j of data){ if(item.createTime == j.createTime){ j.imgPath.push(item.imgPath) } } } return data; } let arrDeal = dealRes(newFn(arr)); console.log(arrDeal);