Most efficient way to remove an item from array?
<p>I have two arrays. If a user adds a product, we put it in the ProductArray. If they remove that product, we add it to the ProductArrayRemove array as well as remove it from the product array.  (We need to know products that have been added as well as products that have been removed. This requires redundancy.)</p>

<pre><code>ProductArray = JSON.parse(ProductArray);
ProductArrayRemove = JSON.parse(ProductArrayRemove);
</code></pre>

<p>When I add and item to the array, I simply do this:</p>

<pre><code> ProductArray.push(ItemID);
 ProductArrayRemove.push(ItemID);
</code></pre>

<p>But when I remove it, I have to do this:</p>

<pre><code>var len = ProductArray.length;
for (i = 0; i &lt; len; i++) {
    ProductID = ProductArray[i];
    if (ProductID == ItemID) {
        ProductArray.splice(i,1);
        break;
    }
}
</code></pre>

<p>It seems that there should be a better way of accomplishing this task.</p>

<p>Is there a more efficient means of getting rid of a single item (that will always be an integer) from an array?</p>
