"Andreas Neumann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > what you can do is: > > > > a=[] > > a['chicken']=whatever > > a.push(a['chicken']) > > > > for (i=0;i<a.length;i++) alert(a) > > ok, got that - works fine so far. But is there a way, while using your above > described for-loop to get at the same time the key of the associative array > back, that is corresponding with the value?
No, you'll have to create objects containing the name value a=[] a['chicken']={key:'chicken',value:whatever} a.push(a['chicken']) Then access them with a[0].key / a[0].value - but of course that's duplicating stuff. var fruits = new Array(); fruits["oranges"] = {key:'oranges',value:25}; fruits.push(fruits["oranges"]); fruits["bananas"] = {key:'bananas',value:15}; fruits.push(fruits["bananas"]); fruits["pineapples"] = {key:'pineapples',value:8}; fruits.push(fruits["pineapples"]); for (i=0;i<fruits.length;i++) { alert(fruits[i].key+','+fruits[i].value); } Which is pretty nasty... Jim. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]