title: Am I doing something wrong? I’m trying to test if all fields are filled in and an API response isn’t invalid
body: <pre><code>  if (
    !document.getElementById(&quot;tousername&quot;).value.length == 0 &amp;&amp;
    !document.getElementById(&quot;fromusername&quot;).value.length == 0 &amp;&amp;
    !document.getElementById(&quot;frompassword&quot;).value.length == 0 &amp;&amp;
    !document.getElementById(&quot;subject&quot;).value.length == 0 &amp;&amp;
    !document.getElementById(&quot;message&quot;).value.length == 0 &amp;&amp;
    !data.username === undefined &amp;&amp;
    !data2.username === undefined) {
      alert(&quot;all good&quot;)
    }
  </code></pre>
  <p>I’m trying to test if all of the fields in the html web page is not empty, and if the 2 responses I get back from this API is not undefined. I want it to alert “all good” if these are all true. It just doesn’t work. Am I doing something wrong?</p>