jessevitrone
11-30-2002, 10:13 AM
I'm using the Array class more like a Hashtable (since I couldn't find one for Javascript).
var array = new Array();
array['name'] = "joe";
array['face'] = "ugly";
Now, I my code, I need to generate a string that looks like this:
name=joe&face=ugly
but I don't know how to loop through and get the keys (maybe index is a better word) from my array.
"name" and "face" could be any values, and I just want to loop though all the keys, and look up their values.
How do I do this with JavaScript? I can't find a way.
Maybe I'd be better off using something besides an Array? I don't really see any other data structures for storing things like this though.
Any suggestions will be greatly apprieciated.
Thanks.
var array = new Array();
array['name'] = "joe";
array['face'] = "ugly";
Now, I my code, I need to generate a string that looks like this:
name=joe&face=ugly
but I don't know how to loop through and get the keys (maybe index is a better word) from my array.
"name" and "face" could be any values, and I just want to loop though all the keys, and look up their values.
How do I do this with JavaScript? I can't find a way.
Maybe I'd be better off using something besides an Array? I don't really see any other data structures for storing things like this though.
Any suggestions will be greatly apprieciated.
Thanks.