I originally planned to use map to do it, but later found that map will return undefined when filtering items that do not meet the conditions, but what I want is to simply divide an array into two according to the filter conditions, so here It would be more appropriate to use filter
//需要分解的数组假设为 Arr1
//先定义两个空数组用于装过滤出来的数据
const Arr2 = []
const Arr3 = []
Arr1.filter(res => {
if (判断条件1) {
return Arr2.push(res)
} else if(判断条件2) {
return Arr3.push(res)
}
})