Solved

accessing array in array items

Posted on 2014-09-03
3
172 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

726 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