title: Finding Member Position in a JS Object
body: <p>What would be the quickest way to find the position of a member in a JS object?</p>
  
  <p>Let's say I have the following object:</p>
  
  <pre><code>var myObject = {
      "apple": { "color" : "green", "shape" : "round" },
      "banana": { "color" : "yellow", "shape" : "long" },
      "orange": { "color" : "orange", "shape" : "round" },
      "kiwi": { "color" : "green", "shape" : "round" }
  }
  </code></pre>
  
  <p>Now, if I want to know the position of banana (i.e. 2), do I need to loop through the object or is there a quicker way?</p>
  
  <p>Update:</p>
  
  <p>Thanks to everyone, I now understand that there is no concept of "order" in an object and I cannot reliably find a position of a member.  Neither do I have the possibility to find the next or previous member.  That all makes perfect sense...</p>
  
  <p>So the way I solved my issue is this:  I looped through my array and fed the keys to an array that I can use to keep track of the members I have in the object.</p>
  
  <pre><code>var fruits = new Array();
  for (var key in myObject) {
      fruits.push(key);
  }
  </code></pre>