//removes all 5 occurrences in array [2,5,9,1,5,8,5]
function removeItemAll(arr, value) {
var i = 0;
while (i < arr.length) {
if (arr[i] === value) {
arr.splice(i, 1);
} else {
++i;
}
}
return arr;
}
console.log(removeItemAll([2,5,9,1,5,8,5], 5))