“2D -Array in JS” Code-Antworten

JS -Array zweidimensional

// 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
Evergreen Tomato

So lesen Sie 2 dimensionales Array in JavaScript


        
            
        
     activities.forEach((activity) => {
    activity.forEach((data) => {
        console.log(data);
    });
});
Friendly Fowl

Erstellen eines 2D -Arrays in JS

var x = new Array(10);

for (var i = 0; i < x.length; i++) {
  x[i] = new Array(3);
}

console.log(x);
Obedient Ox

Erstellen von 2D -Array in JavaScript

var [r, c] = [5, 5]; 
var m = Array(r).fill().map(()=>Array(c).fill(0));
Breakable Boar

2D -Array JavaScript

var items =[
     
  [1,        2,       3],//this is row 0
  [4,        5,       6],//this is row 1
  [7,        8,       9] //this is row 2
//cullom 0   cullom 1   cullom2
  
]

console.log(/* variable name */ items[/*row*/ 0][/*cullom*/ 0]);
Alive Aardvark

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);
 Run code snippetHide results
Shariful Islam

Ähnliche Antworten wie “2D -Array in JS”

Fragen ähnlich wie “2D -Array in JS”

Weitere verwandte Antworten zu “2D -Array in JS” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen