title: Accessing data in JS structure
body: <p>I'm trying to parse the following data:</p>
  
  <pre><code>data = [       
     {"id":"orderBy", "options" : [
         {"value":"order-by=newest&amp;", "name":"newest"},
         {"value":"order-by=relevance&amp;", "name":"relevance"}
     ]},
     {"id":"searchBy", "options" : [
         {"value":"search-by=name&amp;", "name":"name"},
         {"value":"search-by=number&amp;", "name":"number"},
         {"value":"search-by=date&amp;", "name":"date"},
         {"value":"search-by=location&amp;", "name":"location"}
     ]}
  ];
  </code></pre>
  
  <p>Using this data I want to iterate through each object and return its ID, and then all of it options. </p>
  
  <p>I know I need to use for loop like this: </p>
  
  <pre><code>for (var i =0; i &lt; data.length; i++) {
  
    var id = data[i].id;
    var optionText = data[i].options[i].text;
    var optionValue = data[i].options[i].value;
  
    console.log(id);
    console.log(optionText);
    console.log(optionValue); 
  }:
  </code></pre>
  
  <p>This loop only returns the first OptionText &amp; OptionValue from the data. Can you teach me what I'm doing wrong?</p>
  
  <p>Thanks.  </p>