title: How to use array filter for both parent and child values in angular 11
body: <p>I have array object i need to use some condition for fetch the data.</p>
  <pre><code>this.knowledgeData = [
      {
          &quot;id&quot;: 3,
          &quot;name&quot;: &quot;Education&quot;,
          &quot;isOtherCategory&quot;: 0,
          &quot;isKnowledgeSkills&quot;: false,
          &quot;isMyInterest&quot;: false,
          &quot;isParentKnowledgeSkills&quot;: true,
          &quot;isParentMyInterest&quot;: false,
          &quot;subCategories&quot;: [
              {
                  &quot;id&quot;: 96,
                  &quot;categoryId&quot;: 3,
                  &quot;name&quot;: &quot;Careers&quot;,
                  &quot;isOtherSubCategory&quot;: 0,
                  &quot;isKnowledgeSkills&quot;: false,
                  &quot;isMyInterest&quot;: false
              },
              {
                  &quot;id&quot;: 97,
                  &quot;categoryId&quot;: 3,
                  &quot;name&quot;: &quot;General&quot;,
                  &quot;isOtherSubCategory&quot;: 0,
                  &quot;isKnowledgeSkills&quot;: true,
                  &quot;isMyInterest&quot;: false
              },
              {
                  &quot;id&quot;: 92,
                  &quot;categoryId&quot;: 3,
                  &quot;name&quot;: &quot;Home Schooling&quot;,
                  &quot;isOtherSubCategory&quot;: 0,
                  &quot;isKnowledgeSkills&quot;: true,
                  &quot;isMyInterest&quot;: false
              },
          ]
      }
  ]
  </code></pre>
  <p>Have used filter option to find the datas with satisfied conditions..</p>
  <pre><code>this.knowledgeData = this.knowledgeData.filter((x)=&gt;{
            if(x.isParentKnowledgeSkills ===true &amp;&amp; x?.subCategories?.isKnowledgeSkills ===true){
              return true
            }
          })
  </code></pre>
  <p>Its return empty... I need to find the data only the parent and child value return true</p>
  <p>result should be like following</p>
  <pre><code>this.knowledgeData = [
      {
          &quot;id&quot;: 3,
          &quot;name&quot;: &quot;Education&quot;,
          &quot;isOtherCategory&quot;: 0,
          &quot;isKnowledgeSkills&quot;: false,
          &quot;isMyInterest&quot;: false,
          &quot;isParentKnowledgeSkills&quot;: true,
          &quot;isParentMyInterest&quot;: false,
          &quot;subCategories&quot;: [
              {
                  &quot;id&quot;: 97,
                  &quot;categoryId&quot;: 3,
                  &quot;name&quot;: &quot;General&quot;,
                  &quot;isOtherSubCategory&quot;: 0,
                  &quot;isKnowledgeSkills&quot;: true,
                  &quot;isMyInterest&quot;: false
              },
              {
                  &quot;id&quot;: 92,
                  &quot;categoryId&quot;: 3,
                  &quot;name&quot;: &quot;Home Schooling&quot;,
                  &quot;isOtherSubCategory&quot;: 0,
                  &quot;isKnowledgeSkills&quot;: true,
                  &quot;isMyInterest&quot;: false
              },
          ]
      }
  ]
  </code></pre>
  <p>which means output should return the object which is having isKnowledgeSkills is true in child array subCategories</p>