[thelist] Javascript array label index
Joshua Olson
joshua at waetech.com
Fri Sep 10 08:14:59 CDT 2004
> -----Original Message-----
> From: Andreas Wahlin
> Sent: Friday, September 10, 2004 9:09 AM
>
> I'm trying to create an array with a label index, thusly
>
> array["label0"] = value0
> array["label1"] = value1
>
> alert(array["label1"]) // pops up value1
>
> Now this works, though I'm not sure if it's actually an array or if it's
> an object that I can index in some way (perhaps someone can shed
> light?). The important thing I'd like to do however is loop through this
> in some way, but I can't figure out how to do it. It'd be nice to have
> some form of enumerator or simmilar as well. It would have been nice if
> the label arrays had number indexes, so that 0 corresponds to "label0"
> but that doesen't seem to be the case.
Andreas,
You are looking for the for...in syntax.
http://www.devguru.com/Technologies/ecmascript/quickref/for...in.html
Respectfully,
<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168
More information about the thelist
mailing list