Removing all matching elements from the array (rather than just the first as seems to be the most common answer here):
while ($.inArray(item, array) > -1) {
array.splice( $.inArray(item, array), 1 );
}
I used jQuery for the heavy lifting, but you get the idea if you want to go native.