create a 2d array in javascript based on value code example
Example 1: creating a 2d array in js
var x = new Array(10);
for (var i = 0; i < x.length; i++) {
x[i] = new Array(3);
}
console.log(x);
Example 2: creating 2d array in javascript
var [r, c] = [5, 5];
var m = Array(r).fill().map(()=>Array(c).fill(0));