title: Javascript condition in loop
body: <p>This is my input:</p>
  
  <pre><code>    companyList: [
        {
          company_name: 'company1',
          item: 'item1'
        },
        {
          company_name: 'company1',
          item: 'item2'
        },
        {
          company_name: 'company1',
          item: 'item3'
        },
        {
          company_name: 'company2',
          item: 'item4'
        }
      ]
  </code></pre>
  
  <p>And this is how I want to be the output:</p>
  
  <pre><code>    result: [
        {
          company_name: 'company1',
          product: [
            { item: 'item1'},
            { item: 'item2'},
            { item: 'item3'}
          ]
        },
        {
          company_name: 'company2',
          product: [
            { item: 'item4'}
          ]
        }
      ]
  </code></pre>
  
  <p>Using <code>map</code>, how can I get my result?</p>