Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language:
Expertise: Beginner
Aug 11, 2000

Multi-dimensional Arrays

Question:
Can I create multi-dimensional arrays in JavaScript? Do you have an example?

Answer:
Yes and no.

You can't create multi-dimensional arrays (as such) in JavaScript. What you can do is create an array of arrays, though. For instance, you can have:

numberArray = new Array("one","two","three")
letterArray = new Array("a","b","c")
bigArray = new Array(numberArray,letterArray)
You could later reference bigArray[0][1], which would be "b" (arrays are zero-relative).
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date