Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript creating and accessing 2d array

// creating 1d array
var array = new Array(10);

// add an array to each 1d element, hence creating 2d array
for (var i = 0; i < array.length; i++) {
    array[i] = new Array(2);
}

// accessing: first element of the first ro
console.log(array[0][0]);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #creating #accessing #array
ADD COMMENT
Topic
Name
7+1 =