title: check arrays inside an array and filter based on a value in angular 2
body: <p>This is the JSON for user data.</p>
  
  <pre><code>result = {
    "id": 5529,
    "roles": [
      {
        "id": 10,
        "name": "ADMIN",
        "privileges": [
          {
            "id": 100,
            "name": "ADD",
            "systemId": 3
          },
          {
            "id": 115,
            "name": "DEL",
            "systemId": 3
          }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>Have to check the given privilege value exist in the List and return true or false.</p>
  
  <p>Tried few codes but not working as expected, one such code tried is given below.
  Here privilege = DEL, then it should return true.</p>
  
  <pre><code>result.roles.forEach((element:any) =&gt; {
                     element.privileges.filter(function(item:any){
              if(item.name === privilege)
                  return true;
              else 
                  return false;
              });
  </code></pre>
  
  <p>How can I check arrays inside an array efficiently and filter based on a value and return the result.</p>