Two Dimensional Arrays

Results 1 to 4 of 4

Thread: Two Dimensional Arrays

  1. #1
    Join Date
    Dec 1969

    Default Two Dimensional Arrays

    How do you define a 2d array?<BR>I tried the following, but neither worked:<BR><BR>var Address[4][6];<BR>var Address = new Array[4][6];<BR>

  2. #2
    Join Date
    Dec 1969

    Default 2-d arrays not supported.

    you could do one of two things. <BR><BR>1. build an array of arrays, and figure out an algorithm for grabbing stuff out.<BR>2. Flatten them with .toArray() and use them that way (see - &#039;using Getrows From JScript&#039;<BR><BR><BR>j<BR>

  3. #3
    Arky Guest

    Default RE: Two Dimensional Arrays

    Can you be more specific with what type of data you plan on housing.<BR>one way around this is to create an object and stuff it into an array element. The output is below<BR><BR>something like this but not the syntax<BR><BR>var myelement = array[0];<BR><BR>and then<BR><BR>var this1 = myelement.something<BR>var this2 = myelement.something2<BR>var this3 = myelement.something3<BR><BR>in this manner you have properties on an object which are stuffed in an array element. it has its uses depending on the cirsumstances.

  4. #4
    onewiththeuniverse Guest

    Default RE: 2-d arrays not supported.

    JScript arrays are more like hash tables, they are totally dynamic (unlike that of C or C++) Arax is right 2d arrays are not supported but you can do arrays within arrays within arrays...& so on. I&#039;ve always done it this way & it works fine for me.<BR><BR>ex: var xArray = New Array(["array of x length goes here"],["array of y length goes here"],["array of z length goes here"]);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts