title: Remove empty values from array simply - javascript
body: <p>I have looked at previous Q/A and I did not find much help there. Mainly as I did not understand what was coded. </p>
  
  <p>I am just looking to remove any empty values in my array.</p>
  
  <p>My simple approach - that is not working!</p>
  
  <p>My code is -  </p>
  
  <pre><code>var colors = [a, b, c, d, e, f];
  var newArray = [];
  for (var i = 0; i &lt; colors.length; i++) {
    if (colors[i] !== 'undefined' || colors[i] !== null || colors[i] !== "") {
      newArray.push(colors[i]);
    }
  }
  console.log(newArray.length); // == 6 
  console.log(newArray) //== yellow,blue,red,,,
  </code></pre>
  
  <p>I would have thought that my if statement would filter all elements with value and push on to my new array. 
  I really need newArray length to equal 3 and just hold vales, no empty string <code>""</code> should be in the newArray.</p>
  
  <p>Thank you in advance.</p>