sorting - Javascript object automatically sorts -


// mechanics mechanics_isolation : 1, mechanics_na : 2, mechanics_compound : 3,  // mechanics exercise.mechanics = {}; exercise.mechanics[exercise.mechanics_compound] = 'compound'; exercise.mechanics[exercise.mechanics_isolation] = 'isolation'; exercise.mechanics[exercise.mechanics_na] = 'n/a'; 

when loop through exercise.mechanics, keys come out sorted. how can unsorted keys loop through?

thanks!

keys in hashmap not reliable. give keys order. example, put keys array , iterate keys.

var keys = [mechanics_isolation, mechanics_na, mechanics_compound]; (var = 0; < keys.length; i++) {     console.log(exercise.mechanics[keys[i]]); } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -