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]
];