title: Javascript nested filters in Array of arrays
body: <p>I have an array of objects in this format:</p>
  
  <pre><code>var full_list = [
          {
              "pid": 1,
              "items":[
                  {"item_id": '9'},
                  {"item_id": '10'},
                  {"item_id": '12'}
              ]
          },
          {
              "pid": 2,
              "items":[
                  {"item_id": '33'},
                  {"item_id": '22'},
                  {"item_id": '65'}
              ]
          }...
      ];
  </code></pre>
  
  <p>I have a tmp array which consists of objects from the full array:</p>
  
  <pre><code> var tmp_list =  [
          {
              "pid": 2,
              "items":[
                  {"item_id": '33'},
                  {"item_id": '22'},
                  {"item_id": '65'}
              ]
          }, {....}
  </code></pre>
  
  <p>I would like to filter out objects from the full list where at least one of selectedIDs values appears in the object's item's id array</p>
  
  <pre><code>var selectedIDs = {'1', '9', '45', ....};
  </code></pre>
  
  <p>and then add them to the tmp list.</p>
  
  <p>I tried using filters but I failed to figure it out completely.</p>
  
  <p>Thank you.</p>
  
  <pre><code>selectedIDs.forEach(function(id) {
                  var tmp = full_list.filter(function (obj) {
                              obj.items.forEach(function (item) {
                                  if (item.id === id) {
                                      console.log('found');
                                  }
                              });
                          });
                          tmp_list.push(tmp);
                   });
  </code></pre>