title: how to filter strings in nested array?
body: <p>I'm trying to implement a search function that returns find which has search word in the specified array. Let's say, a collection has [aa, ab, aaa], and search word is "a". In this case, return the object to display. Because at least one of the strings in the array has 'a'.</p>
  
  <p>dataStructure</p>
  
  <pre><code>[
    {
     name:'aa',
     searchWords:['aa','ab','bc'] &lt;- I want to use this array for search
    },
    {
     name:'bb',
     searchWords:['bb','bc','de'] &lt;- I want to use this array for search
    },
  ...
  ]
  </code></pre>
  
  <p>I tried to fix the issue, by using includes(), filter(),indexOf(). However still it returns nothing or returns data when the search word is exactly matched.
  How to fix the code to achieve aiming?
  Thank you in advance!</p>
  
  <p><strong>this part works well</strong></p>
  
  <pre><code>let filterStudents = students;
  if (searchName.length &gt; 0 &amp;&amp; searchTag.length === 0) {
    filterStudents = students.filter((student) =&gt; {
      if (
        student.firstName.toLowerCase().includes(searchName.toLowerCase())
        || student.lastName.toLowerCase().includes(searchName.toLowerCase())
      ) {
        return true;
      }
      return false;
    });
  </code></pre>
  
  <p><strong>Problem happens on this part</strong></p>
  
  <pre><code>} else if (searchName.length === 0 &amp;&amp; searchTag.length &gt; 0) {
    filterStudents = students.filter(
      (student) =&gt; {
        console.log(student.tags);
        student.tags.filter((tag) =&gt; {
          console.log(tag);
          tag.indexOf(searchTag) &gt; -1;
        });
      },
    );
  } else if (searchName.length &gt; 0 &amp;&amp; searchTag.length &gt; 0) {
  } else {
    console.log('both');
  }
  </code></pre>