title: Array Map function not able to push Object in simple Example
body: <p>I got data where in an array I got set of objects (with country and states keys along with values).</p>
  
  <p>Now, I need to format data in such a manner, that I got a new array (with countryName as key, and list of states -in array as values). </p>
  
  <p>I am trying to do that but unsuccessful. Can someone help me out?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var data = [
      {
          "country": "United States",
          "states": [
              "Alabama",
              "Alaska",
              "Arizona",
          ]
      },
      {
          "country": "Canada",
          "states": [
              "Ontario",
              "Saskatchewan",
              "Alberta",
          ]
      },
      {
          "country": "Australia",
          "states": [
              "Australian Capital Territory",
              "Jervis Bay Territory",
              "New South Wales",
              "Queensland",
          ]
      }
  ];
  
  newData = []; 
  data.map(item =&gt; newData.push({item.country: item.states});
  console.log(newData);</code></pre>
  </div>
  </div>
  </p>