NovichokJS,
function remove(array, item) {
for (;;) {
let myIndex = array.indexOf(item);
if (myIndex === -1) break;
else array.splice(myIndex, 1);
}
return array
}
const array = [2, 5, 3, 5, 9, 5, 152];
console.log(remove(array, 5))
function removeItem(array, item) {
for (let i = 0; i < array.length;) {
if (array[i] === item) array.splice(i, 1);
else i++;
}
return array
}
const arr = [2, 5, 3, 5, 9, 5, 152];
console.log(removeItem(arr, 5))