title: How to filter an array of complex object
body: <p>I have an array of users and each user has a array of tags
  and I have an array of selected Tags
  What is the best way in ES6 to filter the users by selected tags</p>
  <pre><code>const users = [
    {
      username: &quot;john&quot;,
      tags: [{id:1}, {id:3},{id:5},{id:7}]
    },
    {
      username: &quot;becky&quot;,
      tags: [{id:1}, {id:7},{id:6}]
    },
    {
      username: &quot;susy&quot;,
      tags: [{id:1}, {id:4},{id:5}]
    },
    {
      username: &quot;tyson&quot;,
      tags: [{id:3},{id:5}]
    },
  ];
  </code></pre>
  <p>and my selected tags are</p>
  <pre><code>let tagIds = [7,5];
  </code></pre>
  <p>and I expect to receive a result as</p>
  <pre><code>users = [
    {
      username: &quot;john&quot;,
      tags: [{id:1}, {id:3},{id:5},{id:7}]
    },
  ];
  </code></pre>