How to split a nested array into a new array

list:[
0:Array(n)
old:[
    0:{id: 31, productName: "Old123", stockPrice: 20, }
    1:{id: 32, productName: "Old123", stockPrice: 10, }
    ...
 ],
new:[
    0:{id: 33, productName: "new123", stockPrice: 20, }
    1:{id: 34, productName: "new123", stockPrice: 10, }
    ...
 ],
1:Array(n)
old:[
    0:{id: 35, productName: "Old123", stockPrice: 20, }
    1:{id: 36, productName: "Old123", stockPrice: 10, }
    ...
 ],
new:[
    0:{id: 37, productName: "new123", stockPrice: 20, }
    1:{id: 38, productName: "new123", stockPrice: 10, }
    ...
 ],
 ...
]

there is a nested array. I"m going to push the contents of old to a new array oldlist how to push the contents of new to newlist

oldlist:[
    0:[
        0:{id: 31, productName: "Old123", stockPrice: 20, }
        1:{id: 32, productName: "Old123", stockPrice: 10, }
        ...
    ],
    1:[
        0:{id: 35, productName: "Old123", stockPrice: 20, }
        1:{id: 36, productName: "Old123", stockPrice: 10, }
        ...
    ],
    ...
]
newList:[
    0:[
        0:{id: 33, productName: "new123", stockPrice: 20, }
        1:{id: 34, productName: "new123", stockPrice: 10, }
        ...
    ],
    1:[
        0:{id: 37, productName: "new123", stockPrice: 20, }
        1:{id: 38, productName: "new123", stockPrice: 10, }
        ...
    ],
    ...
]

I traverse list, then traverse old and new, respectively, and push to get an array like this

oldlist:[
    0:{id: 31, productName: "Old123", stockPrice: 20, }
    1:{id: 32, productName: "Old123", stockPrice: 10, }
    2:{id: 35, productName: "Old123", stockPrice: 20, }
    3:{id: 36, productName: "Old123", stockPrice: 10, }
    ...
]

the ps: system requires you to modify the content of the picture and find a new problem by changing it-- |

Nov.10,2021

list2.push(...item.arr1.map(_item => ({name1: _item.name, id1: _item.id})))
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ba7e-3465f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ba7e-3465f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?