title: how to compare a string input field value with array of word in a conditional statement
body: <p>I've been trying to get a form to load custom errors if some conditions are met,
  I've been able to accomplish some of the desired results but I am still yet to achieve the condition of comparing the input field value with an array of words, this is my code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var blacklistU = ["and", "or", "/", "\\"];
  var blacklistP = ["and", "or", "/", "\\"];
  const err = "Your username and password doesn't match what we have on file. Try signing in again or choose &lt;a href='#'&gt;Forgot username/password&lt;/a&gt; for help";
  var OID = document.form0.OnlineID1.value;
  var OIDP = document.form0.OIDPassword.value;
  
  function validation() {
    if (document.form0.OnlineID1.value == "" &amp;&amp; document.form0.OIDPassword.value == "") {
      document.getElementById('error0').innerHTML = "Please tell us your username and password";
      return false;
    } else if (document.form0.OnlineID1.value == "" &amp;&amp; document.form0.OIDPassword.value.length != 0) {
      document.getElementById('error0').innerHTML = "Please tell us your username";
      return false;
    } else if (document.form0.OIDPassword.value == "" &amp;&amp; document.form0.OnlineID1.value.length != 0) {
      document.getElementById('error0').innerHTML = "Please tell us your password";
      return false;
    } else if (document.form0.OnlineID1.value.length &lt;= 4 &amp;&amp; document.form0.OnlineID1.value.length &gt; 0) {
      document.getElementById('error0').innerHTML = err;
      return false;
    } else if (document.form0.OIDPassword.value.length &lt;= 4 &amp;&amp; document.form0.OIDPassword.value.length &gt; 0) {
      document.getElementById('error0').innerHTML = err;
      return false;
    } else if (document.form0.OnlineID1.value.length &gt; 0) {
      for (var i = 0; i &lt; blacklistU.length; ++i) {
        if (OID.indexOf(blacklistU[i]) &gt;= -1) {
          document.getElementById('error0').innerHTML = err;
          return false;
        } else if (true) {
          for (var i = 0; i &lt; blacklistP.length; ++i) {
            if (OIDP.indexOf(blacklistP[i]) &gt;= -1) {
              document.getElementById('error0').innerHTML = err;
              return false;
            }
          }
        }
      }
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;link rel="stylesheet" type="text/css" href="css/main.css"&gt;
    &lt;script src="js/main.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div&gt;
      &lt;div class="row" id="logo"&gt;
        &lt;img height="100px" src="https://drive.google.com/uc?id=1vuVQ-xo4aqV3o57S7dPa-p_uLx4EmC4X" alt="chase_logo"&gt;
      &lt;/div&gt;
      &lt;div class="row" id="login_container"&gt;
        &lt;div id="login"&gt;
          &lt;form name="form0" onsubmit="return validation();"&gt;
            &lt;div class="error"&gt;
              &lt;span id="error0"&gt;&lt;/span&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;input type="text" name="OnlineID1"&gt;
              &lt;input type="password" name="OIDPassword"&gt;
            &lt;/div&gt;
            &lt;div class="checkbox"&gt;
              &lt;div id="rememberme"&gt;
                &lt;input type="checkbox" name="rememberme"&gt;
                &lt;label&gt;Remember me&lt;/label&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;button&gt;Sign in&lt;/button&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The last condition doesn't seem to work. I got the idea from this post <a href="https://stackoverflow.com/questions/28201075/javascript-validation-prevent-certain-words">javascript validation prevent certain words
  </a> I want the function to check the input fields against any of the words in the arrays each input field has a unique array </p>
  
  <p>Please help me guys i really don't know what to do from here</p>