How to get object with largest property from array?
<p>I have an array of objects, with each object containing other 'subobjects'. I need to return the subobject with the largest 'quality' property.</p>

<p>The code below logs out all subobjects. How do I only return the one with the largest quality?</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 maxQuality = function(Arr) {
    Arr.forEach(function(obj, index) {
      Math.max.apply(Math, obj.products.map(function(subObj) {
        console.log(subObj);
      }))
    });
  },
  store = [
    {
      products: [
        {
          quality: 1,
          info: 'info 1'
        },
        {
          quality: 2,
          info: 'info 2'
        },
        {
          quality: 3,
          info: 'info 3'
        }
      ]
    }
  ],
  maxQualityProduct = maxQuality(store);</code></pre>
</div>
</div>
</p>