title: Filter an array of objects with a second array with multiple values
body: <p>I am trying to write a function to take the first object in the "parent" array, pull out the child field (which is in that array) and use that field to filter the second object called "child".</p>
  
  <p>I want to get all the related records from the child object that are in the child field in the parent object.</p>
  
  <p>Expected output</p>
  
  <pre><code>  child: [
      {
        **id: 1,**
        name: 'Jimmy Yukka',
      },
      {
        **id: 2,**
        name: 'Up North',
      }
  </code></pre>
  
  <p>INPUT</p>
  
  <pre><code> Parent: [
      {
        **id: 1,**
        name: 'Melbourne Bands',
        **child: [1, 2]**
      }
  </code></pre>
  
  <p>I have the following data</p>
  
  <pre><code> Parent: [
      {
        **id: 1,**
        name: 'Melbourne Bands',
        **child: [1, 2]**
      },
      {
        id: 2,
        name: 'Sydney Bands',
        child: [3]
      }
    ],
    child: [
      {
        **id: 1,**
        name: 'Jimmy Yukka',
      },
      {
        **id: 2,**
        name: 'Up North',
      },
      {
        id: 3,
        url: 'jimmyyukka.com',
        name: 'INXS',
        CreatedByUserId: 1
      }
    ],
  </code></pre>
  
  <p>The code of the function I have implemented so far:</p>
  
  <pre><code>  currentChildrenIds(ParentId, parentData, childData) {
      const singleParentRecord = parentData.filter(function(parent) {
        return parent.id === ParentId;
      });
      const parentsChildIds = singleParentRecord[0].books;
  
  
      const childRecords = childData.filter(function(child) {
        return child.id === parentsChildIds
      });
  
  
      return childRecords
    }
  </code></pre>
  
  <p><strong>NOTES</strong>
  This bit here is where it is wrong</p>
  
  <pre><code>const childRecords = childData.filter(function(child) {
        return child.id === parentsChildIds
  </code></pre>
  
  <p>This bit here is also a bit rubbish (hardcoding the [0])but not I'm not sure how I should be coding it correctly</p>
  
  <pre><code> const parentsChildIds = singleParentRecord[0].books;
  </code></pre>