title: How to loop through JSON array and get specific values
body: <p>How can I loop through the array below and get the values of "car1"? The code below returns <em>undefined</em></p>
  
  <pre><code>&lt;script&gt;
  var myObj = {
    "cars": {
      "car1":"Ford",
      "car2":"BMW",
      "car3":"Fiat"
    },
    "cars2": {
      "car1":"Ford2",
      "car2":"BMW2",
      "car3":"Fiat2"
    }
  }
  
  for (x in myObj) {
   alert(x.car1);
  }
  
  &lt;/script&gt;
  </code></pre>