title: ES6 - Finding data in nested arrays
body: <p>In ES6 using <code>find</code> or <code>filter</code> I'm quite comfortable iterating through to find an element in an array using a value.</p>
  
  <p>However, I'm trying to get a value from a parent array based upon a value from a nested array.</p>
  
  <p>For example, in this data structure:</p>
  
  <pre><code>products: [
    {
      id: 01,
      items: [
        {
          id: 01,
          name: 'apple'
        },
        {
          id: 02,
          name: 'banana'
        },
        {
          id: 03,
          name: 'orange'
        }
      ]
    },
    {
      id: 02,
      items: [
        {
          id: 01,
          name: 'carrot'
        },
        {
          id: 02,
          name: 'lettuce'
        },
        {
          id: 03,
          name: 'peas'
        }
      ]
    },
    {
      id: 03,
      items: [
        {
          id: 01,
          name: 'eggs'
        },
        {
          id: 02,
          name: 'bread'
        },
        {
          id: 03,
          name: 'milk'
        }
      ]
    }
  ]
  </code></pre>
  
  <p>If I know the <code>name</code> or <code>id</code> of the object <code>milk</code>, is there a way to find out the id of the element it's nested within?</p>
  
  <p>Currently I have this:</p>
  
  <pre><code>products.find((product) =&gt; {
    product.find((prod) =&gt; {
      return prod.name === 'milk';
    });
  });
  </code></pre>
  
  <p>Which only returns the object containing <code>milk</code>.</p>