javascript array.splice() does not remove element in the array?
<p>I have a remove[] array which has all the index positions of all the element with 0 in the data array (as below).</p>

<p>data array:</p>

<pre><code>Retail,1,Utilities,1,Food &amp; Restaurant,3,No Data,4,Construction,0,Non-profit,1,Financial Services,12,Technology,2,Law,3,Religion,3,Retired,2,Insurance,0,Real Estate,2,Audit,3,Business Organizations,3,Media &amp; Marketing,0,Education,3,Transportation,0,Manufacturing,0,Entertainment &amp; Sports,0,Architecture &amp; Engineering,0,Cultural Institutions,0,Government,0,Banking,0,Health Care,0,Business Services,0
</code></pre>

<p>my javascript</p>

<pre><code>   var remove =  [];          
    $.each(options.series[0].data, function(index, item) {
    if (options.series[0].data[index][1] == 0)
    {                    
        //options.series[0].data.splice(index,1);  
        remove[index] = index;                                      

    }

    for (i=0; i&lt;=remove.length; i++)
    {
    //alert(remove);                
    if (remove[i] != undefined)
        options.series[0].data.splice(remove[i],1);

    }   
</code></pre>

<p>data array after splice(). A lot of elements with 0 are still there.</p>

<pre><code>Retail,1,Utilities,1,Food &amp; Restaurant,3,No Data,4,Non-profit,1,Financial Services,12,Technology,2,Law,3,Religion,3,Retired,2,Insurance,0,Audit,3,Business Organizations,3,Media &amp; Marketing,0,Education,3,Manufacturing,0,Entertainment &amp; Sports,0,Cultural Institutions,0,Banking,0,Business Services,0
</code></pre>

<p>if i changed the splice to include replacement element </p>

<pre><code>options.series[0].data.splice(remove[i],1,'removed');
</code></pre>

<p>All 0 elements are removed from the data array. huh? </p>

<pre><code>Retail,1,Utilities,1,Food &amp; Restaurant,3,No Data,4,removed,Non-profit,1,Financial Services,12,Technology,2,Law,3,Religion,3,Retired,2,removed,Real Estate,2,Audit,3,Business Organizations,3,removed,Education,3,removed,removed,removed,removed,removed,removed,removed,removed,removed
</code></pre>

<p>How do I remove all the 0 elements in my data array?</p>
