hwo to egt elngth of 2d array in js 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: js if array is 2d
if (arr[0].constructor === Array) { /*...*/ }