title: how to filter an element of array inside array of objects in java-script without using for loop?
body: <p>my data. data also has empty entries</p>
  <pre><code>const aadharData = [
    {
      firstName: &quot;Ritam&quot;,
      lastName: &quot;Singhal&quot;,
      address: {
        location: &quot;rampur&quot;,
        state: &quot;up&quot;,
      },
      hasDrivingLicense: false,
      emails: [&quot;abc@outlook.com&quot;, &quot;efg@gamil.com&quot;, &quot;ghj@gmail.com&quot;],
    },
    {
      firstName: &quot;Siddarth&quot;,
      lastName: &quot;Singhal&quot;,
      address: {
        location: &quot;chandigarh&quot;,
        state: &quot;haryana&quot;,
      },
      hasDrivingLicense: false,
      emails: [&quot;fgdfg@gmail.com&quot;],
    },
  ];
  </code></pre>
  <p><strong>1.</strong> what I managed to filter out was a list of emails and fullname. with following code</p>
  <pre><code>let gmailList = [];
  aadharData.forEach((info) =&gt; {
    if (info.emails) {
      let fullname = info.firstName + &quot; &quot; + info.lastName;
      let email = info.emails;
      gmailList.push({ fullname, email });
    }
  });
  </code></pre>
  <p><strong>2.</strong> I want to filter only those emailID that are gmails. however, I don't know how to iterate inside the property. I tried using forEach, some, and filter inside forEach but that doesn't seem to work or at least I don't know how to use them effectively. my assignment states I can't use for loop. finally, i want results in the format as</p>
  <pre><code> { fullname, gmail } 
  </code></pre>
  <p>example</p>
  <pre><code>{ fullname: &quot;Mayank Attri&quot;, email: [&quot;abc@gmail.com&quot;] };
  </code></pre>