Hey guys, any help would be greatly appreciated; here's my situation: I created a bunch of variables inside one class the class is ".amount" and here are a few examples of variables: Soccer.amount baseball.amout Hockey.amount etc.. and each of these have number values for example: soccer is 10, baseball is 5, etc. How do I go about listing them all from the highest value to the lowest? like this: Soccer : 10 Baseball : 5 Hockey : 4 etc.. Been searching a lot on the internet for guides but with no success so if anyone here knows how to do that, i would be a happy mofo! thanks in advance
what are Soccer, Baseball and Hockey children of? Do you have a global object / class instance that contains them, like: var foo = { Baseball: { amount: 5 }, Soccer: { amount: 10 } }; Code (javascript): if so, then you need to loop all member properties of foo using for ... in foo and curry them into a simple array of the type such as your desired output (if they have a property amount). You can then apply a sort function and output as you deem fit. otherwise, you are not being very specific - post some example code on www.jsfiddle.net and perhaps somebody will help you.