I want to convert the array passed back in the background to another array form to facilitate my rendering. How can I achieve it?

the data given by the background is as follows

               let arr =[
                    {id:1,name:"",value:15,code:"a1a5a5"},
                    {id:2,name:"",value:25,code:"a5d5sa51"},
                    {id:3,name:"",value:252,code:"bv1c52b"},
                    {id:4,name:"",value:225,code:"wq4e5q"},
                    {id:5,name:"",value:54,code:"p1i2uo1"},
                    {id:6,name:"",value:205,code:"xcz21c"}
                ]

the data I want is to put the first and second data in one object so that I can render them in a loop (that is, put Xiaoming and Daming together)
the data format I want

          let mydata = [
                    {id:1,name:"",value:15,code:"a1a5a5",idTwo:2,nameTwo:"",valueTwo:25,codeTwo:"a5d5sa51"},
                    {id:3,name:"",value:252,code:"bv1c52b",idTwo:4,nameTwo:"",valueTwo:252,codeTwo:"wq4e5q"},
                    {id:5,name:"",value:54,code:"p1i2uo1",idTwo:6,nameTwo:"",valueTwo:205,codeTwo:"wq4e5q"}
                ]

how to achieve it?

Jan.18,2022

  const mergeArr = arr => arr.reduce((res, val, i) => {
    if (i % 2) {
      const obj = res.pop()
      for (const [key, value] of Object.entries(val)) {
        obj[key + 'Two'] = value
      }
      res.push(obj)
    } else {
      res.push(val)
    }
    return res
  }, [])
  console.log(mergeArr(arr))
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-1b4290e-2b366.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-1b4290e-2b366.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?