title: jQuery push multiple objects to array
body: <p><strong>What I'm trying to achieve:</strong><br/>
  Create an array for each country 'item_location' and push object values with 'item_location' as the key.</p>
  
  <p><strong>e.g</strong></p>
  
  <pre><code>[{USA:1},{USA:2}], [{UK:1},{UK:2}], [{CUBA:1},{CUBA:2}]
  </code></pre>
  
  <p><strong>or</strong></p>
  
  <p><strong>e.g</strong></p>
  
  <pre><code>[
   {
    USA: {"Activity/Adventure": 1, "Beach Escape": 2}, 
    UK: {"Activity/Adventure": 1, "Beach Escape": 2}, 
    CUBA: {"Activity/Adventure": 1, "Beach Escape": 2}
   }
  ]
  </code></pre>
  
  <p><br/><br/></p>
  
  <p><strong>Current Problems:</strong><br/>
  The object key says 'item_location' instead of picking up the 'item_location' var value 'item.Location'.</p>
  
  <pre><code>  var filter = [];
    for(var ix = 0; ix &lt; jsonData.length; ix++)
      {
        var item = jsonData[ix];
        var item_location = item.Location;
        var item_ = [{item_location:item["Activity/Adventure"]},{item_location:item["Beach Escape"]}];
        filter.push({item_});
      }
    console.log(filter);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/OEho0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OEho0.png" alt="enter image description here"></a></p>
  
  <p><strong>ANWSER:</strong></p>
  
  <pre><code>function filterData(){
    var filter = [];
    for(var ix = 0; ix &lt; jsonData.length; ix++)
      {
        var item = jsonData[ix];
        var item_location = item.Location;
        var item1 = {}, item2= {};
  
        item1[item_location] = item["Activity/ Adventure"];
        item2[item_location] = item["Beach Escape"];
        var item_ = [item1, item2];
  
        filter.push(item_);
      }
    console.log(filter);
  }
  </code></pre>