title: If statement run if empty string
body: <p>If I do this in the console:</p>
  
  <pre><code>document.querySelectorAll('.error')
  </code></pre>
  
  <p>An object of length 3 is returned.</p>
  
  <p>If any of the property values are empty, then I do not want my if statement to run:</p>
  
  <p>After getting frustrated with this (I was using <code>!= ''</code>) the internet told me to use <code>!== ""</code></p>
  
  <p>Here is the output for property in the object:</p>
  
  <pre><code>document.querySelectorAll('.error')[0]
  ""
  
  document.querySelectorAll('.error')[1]
  "some string"
  
  document.querySelectorAll('.error')[2]
  ""
  </code></pre>
  
  <p>My newness to JS is probably apparent by my question so far. Is the "best" way to check for empty string to use what I have done <code>!==</code>?</p>
  
  <pre><code>&lt;script&gt;
  
  var errorElems = document.querySelectorAll('.error');
  
  for(i=0; i&lt;errorElems.length; i++) {
      if(errorElems[i].textContent !== ""){
          dataLayer.push({
              "event": "errors",
              "eventCategory": "error messages",
              "eventAction": errorElems[i].id,
              "eventLabel": errorElems[i].textContent
              })
          };
      };
  </code></pre>
  
  <p>This appears to be working. But I'm one person checking in one browser (Chrome) on a desktop machine, if that matters.</p>
  
  <p>What would be the most full proof (yet reasonably straightforwards) means to doing this? Is <code>!==</code> best test?</p>