javascript how to create a 2d array code example
Example 1: js initialize 2d array
let data = [];
for (let row=0; row<rows; row++) {
data.push(new Array(cols).fill('#'));
};
Example 2: creating 2d array in javascript
var [r, c] = [5, 5];
var m = Array(r).fill().map(()=>Array(c).fill(0));