accessing array in array items

Posted on 2014-09-03
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?

<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("[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]);

Open in new window

Question by:Isaac
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
LVL 82

Expert Comment

ID: 40301419
Check :


Author Comment

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

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

Accepted Solution

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];

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

697 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