Re: Manipulating in array Multidimensioned Arrays
In the same way that arrays contain integers or strings as values, multidimensional arrays contain arrays as their values. The syntax for a multidimensional array is as follows:
myArray = new Array([2,3,4], [5,5,9], [8,6,1])
To display the first item of the first array (which has an index of 0,0) you would need to use:
document.write(myArray[0][0])
This is known as a two-dimensional array, even though there are three arrays each with three values, as the highest index is 2,2. Referencing each of the items in multidimensional arrays can be cumbersome and confusing, and I have found it easiest to keep arrays singular and just have more of them as necessary, i.e. have three separate arrays rather than one two-dimensional array.
__________________ With,
J. Jeyaseelan Everything Possible |