Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To retrieve values from a multi-dimensional array in JavaScript, you need to specify the index positions for each dimension. For example:

var myArray = [[1, 2], [3, 4], [5, 6]];

// Retrieving value at row 0, column 1
var value = myArray[0][1]; // returns 2

// Retrieving value at row 2, column 0
var value = myArray[2][0]; // returns 5

In this example, myArray is a 3x2 multi-dimensional array. To retrieve a specific value, we specify the row and column index using square brackets. The outer brackets represent the rows while the inner brackets represent the columns.