multidimensional array from literals

A

aamirghanchi

Hi,

what is the correct way of creating a two dimensional array right from
the literals in a single statement.

eg: a one dimensional array could be created in a single statement as
follows:

var sdarray = ["John", "Bob", "Sue"] ;

What needs to be done if the above were a 2D array.

TIA
 
V

VK

Hi,

what is the correct way of creating a two dimensional array right from
the literals in a single statement.

eg: a one dimensional array could be created in a single statement as
follows:

var sdarray = ["John", "Bob", "Sue"] ;

What needs to be done if the above were a 2D array.

Pseudo-2D array to be exact (array or arrays):

var arr = [ ["John", "Bob", "Sue"], ["Doe", "Smith", "Jackson"] ];
alert (arr[0][0] + ' ' + arr[0][1]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top