title: Array of products arrange by category
body: <p>I'm trying to arrange this array of products by categories. For now, I get the count of each category but I can't figure out how to make this two dimension array output.</p>
  <pre><code>let products = [
    {name: 'Tequila', category: 'drink'}, 
    {name: 'Beer', category: 'drink'}, 
    {name: 'Burger', category: 'food'},
    {name: 'Shawarma', category: 'food'}, 
    {name: 'Wine', category: 'drink'},
    {name: 'Gelatto', category: 'dessert'}
  ];
  
  /*expected ouput
  
  let arranged = [[
    {name: 'Tequila', category: 'drink'}, 
    {name: 'Beer', category: 'drink'},
    {name: 'Wine', category: 'drink'}
  ], [
    {name: 'Burger', category: 'food'},
    {name: 'Shawarma', category: 'food'}
  ], [
    {name: 'Gelatto', category: 'dessert'}
  ]];
  
  */
  </code></pre>
  <p>This is my code for now:</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>let products = [
    {name: 'Tequila', category: 'drink'}, 
    {name: 'Beer', category: 'drink'}, 
    {name: 'Burger', category: 'food'},
    {name: 'Shawarma', category: 'food'}, 
    {name: 'Wine', category: 'drink'},
    {name: 'Gelatto', category: 'dessert'}
  ];
  
  let arranged = {};
  
  products.map(x =&gt; arranged[x.category] = 1 + (arranged[x.category] || 0));
  
  console.log(arranged);</code></pre>
  </div>
  </div>
  </p>