title: What is the difference between array.splice(array.indexOf('') and array.filter(x => x !== "") in javascript?
body: <p>I was trying to remove empty strings ('') from an javascript array.
  For example: ['a','b', '', '', '', 'c', ''] ---&gt; ['a', 'b', 'c']</p>
  <p>So i tested two commands:</p>
  <pre><code> array.splice(array.indexOf(''))
  </code></pre>
  <p>and</p>
  <pre><code>array.filter(x =&gt; x !== &quot;&quot;)
  </code></pre>
  <p>both commands worked. But now i'm confused about their differences.</p>