Take the data step by step?

arr= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
how to dynamically fetch data according to the step size of this array?

  var arr=[1,2,3,4,5,6,7,8,9,10]
    var eachGroup=[]
    for(var i=0;i<arr.length/3;iPP){
        tmp=[]
        tmp.push(i);
           while(i+3<arr.length){
             tmp.push(i+3);
        }
        eachGroup.push(tmp)
    }
    console.log(eachGroup)
Mar.07,2022

var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const { eachGroup } = arr.reduce(
  ({ eachGroup, step }, item, index) => (
    index % step === 0
      ? eachGroup.push([item])
      : eachGroup[eachGroup.length - 1].push(item),
    { eachGroup, step }
  ),
  { eachGroup: [], step: 3 },
)
console.log(eachGroup) // [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ], [ 10 ] ]
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-1b3fba4-2c4cd.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-1b3fba4-2c4cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?