Js array object format conversion

//
[{name: "title", value: "1"},
{name: "startTime", value: "17:00:16"},
{name: "endTime", value: "19:01:18"},
{name: "title", value: "2"},
{name: "startTime", value: "20:03:18"},
{name: "endTime", value: "21:04:20"}]
//
[{title: "1", startTime: "17:00:16", endTime: "19:01:18"},
{title: "2", startTime: "20:03:18", endTime: "21:04:20"}]

I wrote a lot of loops to implement it, so I would like to ask if there is a more elegant way to implement it

Apr.07,2021

I wonder if this meets the requirements?

let root = [
  {name: "title", value: "1"},
  {name: "startTime", value: "17:00:16"},
  {name: "endTime", value: "19:01:18"},
  {name: "title", value: "2"},
  {name: "startTime", value: "20:03:18"},
  {name: "endTime", value: "21:04:20"}
];

function func(obj){
  let res = [];
  let temp = {};
  obj.forEach((item,index)=>{
    temp[item.name] = item.value;
    if((index+1)%3 === 0){
      res.push(temp);
      temp = {};
    }
  });
  return res;
}

console.log(func(root));
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-1b3c0f7-2ba5f.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-1b3c0f7-2ba5f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?