Web Analytics Made Easy -
StatCounter 2 Dimensional Array = New Array( New Array())??? - CodingForum


No announcement yet.

2 Dimensional Array = New Array( New Array())???

  • Filter
  • Time
  • Show
Clear All
new posts

  • 2 Dimensional Array = New Array( New Array())???

    I am trying to create a 2 dimensional array with size unknown until run-time.

    My code:

    myarray = new array (new array());
    ....some codes that has nothing to do with this array, it just change the i value....
    myarray[15][i++] = j;

    It doesn't work. I know that the length of the outer array at that time is 1. so it's has only size of 1, but I am requesting index 15. But I need to write the value at index 15 or any other indexes at any given time. But I don't want to create a limited size for the array because there is no way to know the size of the array until run-time.

    I use Venkman debugger, and it just stop debugging at the second line of code.

    Many thanks.
    Last edited by dealmaker; Aug 3, 2005, 01:07 AM.

  • #2
    ok, it seems that javascript can only expand array at next unoccupied index, I can't jump ahead. So, I just changed my code accordingly.

    Problem solved.