HEEEEELP .... Multidimentional Arrays

Results 1 to 2 of 2

Thread: HEEEEELP .... Multidimentional Arrays

  1. #1
    Ben Verwey Guest

    Default HEEEEELP .... Multidimentional Arrays

    HEEEEEELP,<BR><BR>I can&#039t seem to properly define a multidimentional (in this case 2 dimentional) array. I am having trouble working out the brackets thing I tried every logical combination plus more and it never works right.<BR><BR>What I am trying to do is have an 2d array, the first array is a set of numbers and the second array is a set of words that correspond to those numbers.<BR><BR>I am trying to do this<BR>var MasterList = new Array([1,2,3], ["word","word","word"]);<BR><BR>I&#039ve tried every combination of ( and [ brackets that I can think of and nothing seems to work right.<BR><BR>PLease HELP<BR>Ben<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: HEEEEELP .... Multidimentional Arrays

    Slightly modified from Microsoft&#039s JScript documentation:<BR><BR>&#060;html&#062;<BR>&#060;SC RIPT LANGUAGE="JScript"&#062;<BR>function doIt()<BR>{<BR>var MyArray = {"a" : "Athens", "b" : "Belgrade", "c" : "Cairo" };<BR>alert(MyArray["a"] + " " + MyArray["b"] + " " + MyArray["c"]);<BR>}<BR>&#060;/SCRIPT&#062;<BR>&#060;body onload="doIt();"&#062;<BR><BR>&#060;/html&#062;<BR><BR><BR>Check into the dictionary object. I think it may be easier to use it for what you&#039re doing.<BR><BR>Good luck.

Posting Permissions

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