javascript array of arrays get one row code example
Example 1: js array two dimensional
// declaration of a two-dimensional array
// 5 is the number of rows and 4 is the number of columns.
const matrix = new Array(5).fill(0).map(() => new Array(4).fill(0));
console.log(matrix[0][0]); // 0
Example 2: javascript array column
//get column in javascript...
function getCol(matrix, col){
var column = [];
for(var i=0; i<matrix.length; i++){
column.push(matrix[i][col]);
}
return column; // return column data..
}
var array = [new Array(20), new Array(20), new Array(20)]; //..your 3x20 array
getCol(array, 0); //Get first column