How do I get the contents of my array in ascending order of the keys

0

I'm having a problem with an app function that I'm creating. I am a beginner in programming to improve my knowledge and wanted to know how to make my function get the contents of the keys of my array in ascending order of these.

Example:

var exemplo = {
    "1":"chave1",
    "2":"chave2",
    "3":"chave3"
}
  

In this case, I wanted him to pick up the contents of the keys in order   and when you get to the last key, go back to the first one by creating a loop.

So, returning the value of my key "1", after "2" and "3", returning to the beginning and repeating the process. It's a more useful method than picking a random value using Math since I wanted it to be in order rather than randomly.

    
asked by anonymous 13.04.2017 / 00:33

0 answers