title: JavaScript checking an array of objects is coming up false when it should be true
body: <p>Working on a pseudo login form and ran into a problem with the if-else statement. I created a function to check an array of objects when submitted and see if they match the text inside the input. The last else statement is supposed to print only if the email input is not found. I discovered taking out the last else statement fixed the issue, but made it impossible to print 'user not found' if there were no matches. Pretty sure it's a simple fix but I cannot seem to find what is wrong. </p>
  
  <p>How do I get this to run properly without deleting that last else statement? (Included the HTML for reference.)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var logForm = document.querySelector("#logForm");
  var output = document.querySelector("#output");
  
  var users = [{
    email: "email1@address.com",
    password: "123"
  }, {
    email: "email2@address.com",
    password: "123again"
  }, {
    email: "email3@address.com",
    password: "123again2"
  }];
  
  var submitHandler = function(e) {
    e.preventDefault();
    output.innerText = '';
    var inputEmail = logForm.email.value;
    var inputPassword = logForm.password.value;
    console.log(inputEmail);
    console.log(inputPassword);
    for (var i = 0; i &lt; users.length; i++) {
      if (inputEmail === users[i].email) {
        if (inputPassword === users[i].password) {
          output.innerHTML = "Successfully logged in as " + users[i].email;
        } else {
          output.innerHTML = "Invaild password.";
        }
      } else {
        output.innerHTML = "User not found.";
      }
    }
  };
  
  
  logForm.addEventListener('submit', submitHandler);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Login Form&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;p&gt;
      &lt;form id="logForm"&gt;
        &lt;input type="text" name="email" placeholder="E-mail"&gt;&lt;/input&gt;
        &lt;input type="text" name="password" placeholder="Password"&gt;&lt;/input&gt;
        &lt;button type="submit"&gt;Log In&lt;/button&gt;
      &lt;/form&gt;
    &lt;/p&gt;
    &lt;p id="output"&gt;&lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>