title: Extract first object from array with es6 array methods
body: <p>I have this code to get an array of one object:</p>
  
  <pre><code>let selectedShop = initialResultsState.get('products')
          .filter(product =&gt; product.shop.selected)
  </code></pre>
  
  <p><code>console.log(selectedShop)</code></p>
  
  <p>result:</p>
  
  <p><a href="https://i.stack.imgur.com/lSiC5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lSiC5.png" alt="enter image description here"></a></p>
  
  <p>Can I extract the object from the array in the same operation by stringing another es6 array method to the end of <code>filter</code>, rather than doing <code>let newVariable = selesctedShop[0]</code>?</p>
  
  <p>I tried to string this to it:</p>
  
  <pre><code>.map(x =&gt; {return { shop: x.shop, products: x.products }})
  </code></pre>
  
  <p>but it is still an array of one object because map always returns a new array.</p>