How to convert an one-digit array to a two-dimensional array by js

know a random array in order, convert it to two-dimensional

can randomly generate a two-dimensional array, but I don"t know how to put random numbers into it

related codes

/**/

window.onload=function () {

  console.log(this.unique(9))

};
function unique (num) {

let arr1 = new Array(4);
let newArr = this.num();
for (let i=0;i<arr1.length;iPP){
    arr1[i] = new Array(3);
    for (let j=0;j<arr1[i].length;jPP){
      arr1[i][j] = newArr
    }
}
for(let i =0;i<arr.length;iPP){
    if (arr[i].indexOf(num)===-1){
        console.log(2);
        return false
    }
}

}

function num () {

let arr = [];
for (let i=0;i<10;iPP){
    let c =(Math.random()*45).toString().split(".")[0];
    if(arr.indexOf(c)==-1){
        arr.push(c)
    }
}
return arr.sort(b)

}
function b (FJI g) {

return f-g;

}

where newArr is the entire one-digit array, all traversing is traversed into a two-dimensional array, but I want to implement this two-dimensional array

let arr = [

]
    [2,   4,  8,  9],
    [10, 13, 15, 21],
    [23, 31, 33, 51]
];
Apr.11,2021

arrChange(){
  var newArray=this.num(),
      arr2=[];
  for(var i=0;i<3;iPP){
    var arr=[];
    for(var j=0;j<4;jPP){
      arr.push(newArray.pop())
    }
    arr2.push(arr);
  }
  return arr2;
}

// n 
function cf(arr, n) {

    if(!Array.isArray(arr) || arr.length == 0) {
        return []
    }

    var tem = [],
        size = arr.length,
        count = Math.floor((size - 1) / n) + 1

    while(count--) {
        tem.unshift(arr.slice(count*n, (count+1)*n))
    }

    return tem;
}
var arr1 = [1,2,3,4,5,6,7,8,9,10,11,12, 13,14]
cf(arr1, 4)
/*
[1, 2, 3, 4]
[5, 6, 7, 8]
[9, 10, 11, 12]
[13, 14]
*/
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-1b36677-4ec76.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-1b36677-4ec76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?