There are so many pieces of data in the array, how can they be intercepted every 10?

there is an array like data, about 500 + data. I want to form an array every 10 items and put them all in arr. Ask for advice

const data = [
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  { img: "a" },
  ...
]
const arr = [
  [{ img: "a" }, { img: "a" }, { img: "a" },],
  [{ img: "a" }, { img: "a" }, { img: "a" },],
  [{ img: "a" }, { img: "a" }, { img: "a" },],
  [{ img: "a" }, { img: "a" }, { img: "a" },]
]
Jun.18,2021

lodash.chunk learn about


lodash_chunk():

        function _chunk(arr, num) {
                let j = 0,
                    o = j;
                let newArray = [];
                while (j < arr.length) {
                    j += num;
                    newArray.push([arr.slice(o, j)]);
                    o = j;
                }
                return newArray;
            
        }
_chunk([1,2,3,4,5], 2)//[[1,2],[3,4],[5]]
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-1bdc49e-312c4.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-1bdc49e-312c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?