Test case details

Preparation Code

<script> // Array Remove - By John Resig (MIT Licensed) // simplified Array.prototype.remove = function(ind) {   var rest = this.slice(ind + 1);   this.length = ind;   return this.push.apply(this, rest); }; </script>
var a = [], i = 0;     while (i < 1000)         a[i++] = Math.floor(Math.random() * 10);

Test cases

Test #1

var b = a.slice(), i = 0, el; while (i < b.length) {     el = b[i++];     if (el === 5)         b.splice(i-1, 1); }

Test #2

var b = a.slice(), el, i = 0, j = 0; while (i < b.length) {     el = b[i++];     if (el !== 5)         b[j++] = el; } b.length = j;

Test #3

var b = a.slice(); var c = [], i = 0, el; while (i < b.length) {     el = b[i++];     if (el !== 5)         c[c.length] = el; }

Test #4

var b = a.slice(), i = 0, el; while (i < b.length) {     el = b[i++];     if (el === 5)         b.remove(i-1); }