How to remove all occurrences of a multiple occurring element in an array in Javascript?
<p>For example, removing the value 2 from the array </p>

<pre><code>[1, 2, 3, 2, 4]
</code></pre>

<p>should produce the result </p>

<pre><code>[1, 3, 4]
</code></pre>

<p>If I use filter it only removes the second and succeeding occurrences, which is not what I want. </p>

<p>All values that occur multiple times should be removed entirely.</p>