title: Iterate through an array of objects in JavaScript
body: <p>I have an array of objects that looks like this:</p>
  
  <pre><code>var model = ([{ "MKT_BRAND_NAME": "LUX", "Brand_GRP": 783.52, "Category_GRP": 0.0, "SOV": 0.051, "MM": "10", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null  },
             { "MKT_BRAND_NAME": "LUX", "Brand_GRP": 356.12, "Category_GRP": 0.0, "SOV": 0.050, "MM": "11", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null },
             { "MKT_BRAND_NAME": "LUX", "Brand_GRP": 935.27, "Category_GRP": 0.0, "SOV": 0.23, "MM": "7 ", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null},
             { "MKT_BRAND_NAME": "LUX", "Brand_GRP": 3380.81, "Category_GRP": 0.0, "SOV": 0.15, "MM": "8 ", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null },
             { "MKT_BRAND_NAME": "LUX", "Brand_GRP": 3536.21, "Category_GRP": 0.0, "SOV": 0.15, "MM": "9 ", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null}
             { "MKT_BRAND_NAME": "PEARS", "Brand_GRP": 3380.81, "Category_GRP": 0.0, "SOV": 0.18, "MM": "8 ", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null },
             { "MKT_BRAND_NAME": "PEARS", "Brand_GRP": 3536.21, "Category_GRP": 0.0, "SOV": 0.17, "MM": "9 ", "QUARTER": "", "YYYY": "2014", "TargetGroupId": null}]);
  </code></pre>
  
  <p>I want to display SOV and MM values for a particular MKT_BRAND_NAME. I want to assign MKT_BRAND_NAME to "key" and MM and SOV pair to "values".Something like this</p>
  
  <pre><code>  var model = [{
              "key": "Lux",
              "values": [{MM:"10",SOV:0.015},
                         {MM:"11",SOV:0.050},
                         {MM:"7",SOV:0.23},
                         {MM:"8",SOV:0.15},
                         {MM:"9",SOV:0.15}]
                      }, {
             "key": "Pears",
             "values": [{MM:"8",SOV:0.018},
                        {MM:"9",SOV:0.017},
  
          }];
  </code></pre>
  
  <p>Can any one please tell me how to achieve this through <code>for</code> loop in  <code>JavaScript</code>. </p>