[Javascript] multidimensional associative arrays

Anthony Ettinger apwebdesign at yahoo.com
Tue Oct 4 14:26:09 CDT 2005


associative array uses a word, not a number for the
index.



--- Flavio Gomes <flavio at economisa.com.br> wrote:

> Sending my Example:
> 
> <script language="JavaScript">
> 
>  x = 0;
>  array = new Array('a','b','c');
> 
>  while(array[x])
>  { array[x] = new
> Array(array[x]+'1',array[x]+'2',array[x]+'3')
>    x++;
>  }
> 
>  alert(array);
>  alert(array[1]);
>  alert(array[1][1]);
> 
> </script>
> 
> -- 
> Flavio Gomes
> flavio at economisa.com.br
> 
> 
> 
> SkyScanner wrote:
> 
> >results = new Array();
> >
> >results[0] = ["KQ2M", "4", "41.393200",
> "-73.320100"];
> >results[1] = ["N9RV", "5", "40.295400",
> "-85.262500"];
> >results[2] = ["KV0Q", "5", "39.504800",
> "-104.738200"];
> >results[3] = ["N2NT", "5", "40.379300",
> "-74.495900"];
> >results[4] = ["NX5M", "5", "30.440100",
> "-96.498500"];
> >results[5] = ["K1SE", "5", "38.747800",
> "-77.485300"];
> >results[6] = ["W0AIH", "5", "44.744100",
> "-91.294500"];
> >results[7] = ["W4MYA", "5", "37.717900",
> "-78.005900"];
> >results[8] = ["K9NW", "4", "39.328400",
> "-84.546500"];
> >results[9] = ["W9RE", "4", "39.661300",
> "-85.994900"];
> >
> >or
> >
> >viewlist90 = {
> >colname: ["Name","State","County","Fips","Area
> sq-mile","Area
> >sq-m","Population","Pop Density"],
> >colwidth: [20,6,20,6,12,12,12,12],
> >coldata: [
>
>{z0:"Anson",z1:"ME",z2:"Somerset",z3:"23-01360",z4:"1.3206",z5:"3420335",z6:
> >"818",z7:"619.416"},
>
>{z0:"Auburn",z1:"ME",z2:"Androscoggin",z3:"23-02060",z4:"59.7846",z5:"154841
> >502",z6:"23203",z7:"388.11"},
>
>{z0:"Augusta",z1:"ME",z2:"Kennebec",z3:"23-02100",z4:"55.3812",z5:"143436533
> >",z6:"18560",z7:"335.132"},
>
>{z0:"Bangor",z1:"ME",z2:"Penobscot",z3:"23-02795",z4:"34.446",z5:"89214664",
> >z6:"31473",z7:"913.692"},
> >{z0:"Bar
>
>Harbor",z1:"ME",z2:"Hancock",z3:"23-02830",z4:"3.14878",z5:"8155298",z6:"268
> >0",z7:"851.124"},
>
>{z0:"Bath",z1:"ME",z2:"Sagadahoc",z3:"23-03355",z4:"9.1127",z5:"23601779",z6
> >:"9266",z7:"1016.82"},
>
>{z0:"Belfast",z1:"ME",z2:"Waldo",z3:"23-03950",z4:"34.039",z5:"88160555",z6:
> >"6381",z7:"187.462"},
>
>{z0:"Berwick",z1:"ME",z2:"York",z3:"23-04685",z4:"1.53112",z5:"3965578",z6:"
> >1993",z7:"1301.66"}
> >]
> >}
> >
> >
> >Tim in Ireland
> >
> >----- Original Message ----- 
> >From: "Anthony Ettinger" <apwebdesign at yahoo.com>
> >To: <javascript at latech.edu>
> >Sent: Tuesday, October 04, 2005 6:29 PM
> >Subject: [Javascript] multidimensional associative
> arrays
> >
> >
> >  
> >
> >>It's been a long time since I've done one of these
> in
> >>javascript.
> >>
> >>But I need the equivalent of a perl hashref:
> >>
> >>localToRemoteMapping[id][attrib] = value;
> >>
> >>How do I define a multidimensional array?
> >>
> >>
> >>
> >>
> >>Anthony Ettinger
> >>ph: (408) 656-2473
> >>blog: http://www.chovy.com
> >>
> >>
> >>
> >>__________________________________
> >>Yahoo! Mail - PC Magazine Editors' Choice 2005
> >>http://mail.yahoo.com
> >>_______________________________________________
> >>Javascript mailing list
> >>Javascript at LaTech.edu
>
>>https://lists.LaTech.edu/mailman/listinfo/javascript
> >>
> >>    
> >>
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
>
>https://lists.LaTech.edu/mailman/listinfo/javascript
> >  
> >
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 


Anthony Ettinger
ph: (408) 656-2473
blog: http://www.chovy.com


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com



More information about the Javascript mailing list