help with arrays within array in javascript
Is it possible to declare an array within a array like this:
var aryOption = new Array();
aryOption[0][0] = new Array(1,2,3);
aryOption[0][1] = new Array('A','B','C');
aryOption[1][0] = new Array(4,5,6);
aryOption[1][1] = new Array('D','E','F');
//Can i access the value by doing this?
var aryTest = new Array();
aryTest = aryOption[0][0];
alert(artTest[1]); //will this return '2'?
Is there other ways to do this?
Please help.
[572 byte] By [
debbie] at [2007-11-18 18:09:39]

# 1 Re: help with arrays within array in javascript
Yes you can have arrays within arrays, but why can't you test this yourself ?.
You got a few bugs in your code, to have arrays within arrays you have to create them, so the beginning of your code should look like
var aryOption = new Array();
aryOption[0] = new Array();
aryOption[1] = new Array();
aryOption[0][0] = new Array(1,2,3);
aryOption[0][1] = new Array('A','B','C');
aryOption[1][0] = new Array(4,5,6);
aryOption[1][1] = new Array('D','E','F');
and then you had a typo in the last half which, should have read
//Can i access the value by doing this?
var aryTest = new Array();
aryTest = aryOption[0][0];
alert(aryTest[1]); //will this return '2'?
khp at 2007-11-8 0:19:09 >
