title: Removing empty strings from array (Regex) - Javascript
body: <p>I have the following code in my project:</p>
  
  <pre><code>for(i = 0; i &lt; inputArr.length; i++) {
      if(accountsBool) {
          inputArr[i] = inputArr[i].split(/\s+/);
          if (inputArr[i] == "" || !inputArr[i].match(/[^\s]/)) {
              inputArr.splice(i,1);
          }
      }
  }
  </code></pre>
  
  <p>I'll try to explain the issue the best I can...</p>
  
  <p>I need this portion of the code to remove all whitespace and empty strings, but the lines...</p>
  
  <pre><code>inputArr[i] = inputArr[i].split(/\s+/);
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>if (inputArr[i] == "" || !inputArr[i].match(/[^\s]/)) {
      inputArr.splice(i,1);
  }
  </code></pre>
  
  <p>...don't work together. I get the error, "Object doesn't support this property or method". If I comment out one and run the code with the other it seems to work fine. The syntax seems to be right too. Any ideas?</p>
  
  <p>inputArr is an array of strings that is parsed in from a text area.</p>
  
  <p>Thank you.</p>