Order of the associative array in javascript by key and access by index

lafayettemoon

New Member
I have got a associative array like:\[code\]var arr={};arr['alz']='15a';arr['aly']='16b';arr['alx']='17a';arr['alw']='09c';\[/code\]I need to find the previous and next key of any selected element. Say, for key 'aly' it will be 'alz' and 'alx'. Is it possible. If possible, I want to access the array by index rather than the key.Currently, I am doing this using a separate array containing keys, e.g.\[code\]var arrkeys=['alz','aly','alx','alw']\[/code\]
 
Back
Top