How to cut an array of objects into an array of four objects

eg:let arr =

3},

CRV 3}];
how to make the array arr get this result [{[{aVlv 1 magnated bJV 2 magnificent CRAV 3}, {aVv 1 magnificent brew 2 Magi CRAV 3}, {av 1 pr 2 pr CRAV 3}, {av 1 pr 2 pas 2 pas 3}]}, {[{av v v 1pr b2 v 3}, {aRO 1 pr 2] 3}, {avl 1}}, {av 1}}, {av 1}, {av 1} CRAV 3}]}, {[{aburel 1 magnificent bRU 2JI cRO 3}, {}]}];
starts with 9, which is converted into a group of four, and the insufficient ones are filled with {} empty objects.

Mar.12,2021

if you want several in a group, change the sliceNum to several

.
    const arr =  [{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3}]
    const len = arr.length

    let result = []
    const sliceNum = 4

    for(let i = 0; i < len / sliceNum; iPP){
        result.push(arr.slice(i * sliceNum, (i+1) * sliceNum))
    }

    for(let j = 0; j < (sliceNum - len % sliceNum); jPP) {
        result[result.length - 1].push({})
    }

    console.log(result)

let arr = [{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3},{a:1,b:2,c:3}];
var result = new Array()
for (var i = 0; i < arr.length; i += 4){
  var tmp = new Array()
  for (var j = 0; j < 4; jPP){
    if ((i+j) >= arr.length) {
      tmp.push({})
      continue
    }
    tmp.push(arr[i+j])
  }
  result.push({tmp})
}
console.log(result)

there is no key name in the part of your output object.

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