title: Array of objects return object when condition matched
body: <p>I have an array which have value of id, email and password.</p>
  
  <pre><code>let array = [
   {id: hyu, email: a@a.com, password: 123},
   {id: rft, email: b@b.com, password: 456},
   {id: ght, email: c@c.com, password: 789},
   {id: kui, email: d@d.com, password: 679}
  ]
  </code></pre>
  
  <p>Now I would like to return that object when my condition is matched. For that I created a function using javascript <code>some</code> function but I want to return the object and we know that <code>some</code> function return boolean.</p>
  
  <p>I don't have any idea how to do this.</p>
  
  <p>My code is: </p>
  
  <pre><code>const isEmailExists = (email, array) =&gt; {
    return array.some(function(el) {
      return el.email === email;
    });
  };
  
  if (isEmailExists("c@c.com", array) == true) {
    // I want to work here with returned objects i.e on success case
  } else {
    // error case
  }
  </code></pre>
  
  <p>Any help is really appreciated</p>