首页 > 编程知识 正文

js数组替换成新数组,js数组对象排序

时间:2023-05-05 06:24:41 阅读:11668 作者:3003

处理前的源数组

let应用列表=[

{ applyNo: “1”、apply date :“2021-04-2210336041336031”、yearMonth: “2021年04月”}、

{ applyNo: “2”、apply date :“2021-04-131133602:18”、yearMonth: “2021年04月”}、

{ applyNo: “3”、apply date :“2021-03-0409336037336049”、yearMonth: “2021年03月”}、

{ applyNo: “4”、apply date :“2021-03-1717336052336027”、yearMonth: “2021年03月”}、

];

处理后的目标数组

let applyListHandle=[

{yearMonth: “2021年04月”、handle: [{ applyNo: “1”、apply date :“2021-04-2210336041:31”、year mor

{yearMonth: “2021年03月”,handle: [{ applyNo: “3”,apply date :“2021-03-04093360:49”,year monton

]

代码如下。

let tempArr=[]; this.apply list.foreach (index ((if ) temparr.indexof ) this.apply list [ index ].year month )=-1 ) this.applyly } else { this.applylisthandle.foreach ((it,I )=) if ) this.applylisthandle [ I ].year month==this.apply list }; ); }; ); //console.log (this.applylisthandle,' applylisthandle ';

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。