Possible Duplicate:
Loop through associative array in reverse
I have a key-value pair javascript object.
How do I reverse() it? or loop it starting from the bottom.
jQuery available.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no hard specification or guarantee of determining the order of properties in a Javascript object. Most browsers go from what was added first to last, but as Elements order in a "for (… in …)" loop
describes, Chrome and Opera do not.
If order is important to you, then you must use an array, or have an array that lists the order in which the properties should be accessed when looping (from either direction).