?
Solved

accessing array in array items

Posted on 2014-09-03
3
Medium Priority
?
175 Views
Last Modified: 2014-09-03
How can I access an array item in another array?
How can access ["AC1", "AC2"],["BC1", "BC2"], and ["DD1", "DD2"] from the ListOfColumns array below?

Ex:
<script type="text/javascript">
	var ListOfColumns = [["AA", "AB", ["AC1", "AC2"], "AD AE"], ["BB", "BB", ["BC1", "BC2"], "BD BE"], ["CA", "CB", "CC"], ["DD", "DE", ["DD1", "DD2"]]];
	console.log(ListOfColumns);
	console.log("[0]: "+ListOfColumns[0]);
	console.log("[0][0]: "+ListOfColumns[0][0]);
	console.log("[0][1]: "+ListOfColumns[0][1]);
	console.log("[0][2]: "+ListOfColumns[0][2]);
	console.log("[0][3]: "+ListOfColumns[0][3]);
	console.log("[1]: "+ListOfColumns[1]);
	console.log("[1][0]: "+ListOfColumns[1][0]);
	console.log("[1][1]: "+ListOfColumns[1][1]);
	console.log("[1][2]: "+ListOfColumns[1][2]);
	console.log("[1][3]: "+ListOfColumns[1][3]);
	console.log("[2]: "+ListOfColumns[2]);
	console.log("[3]: "+ListOfColumns[3]);
</script>

Open in new window

0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 40301419
Check :

console
0
 
LVL 5

Author Comment

by:Isaac
ID: 40301530
I was able to do that.
I think I explained it wrong.

How do I access just "AC1", "BC1" or "DD1"?
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 40301534
var ac1 = ListOfColumns[0][2][0];
var bc1 = ListOfColumns[1][2][0];
var dd1 = ListOfColumns[3][2][0];
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question