The code I have right now, removes most of the instances, however it does not remove all of them. What am I doing wrong?
let nums = [1, 90, 90, 1123, 90, 4534, 90, 90, 90, 90, 90];
function removeAll(array, item) {
for (var i = 0; i < array.length; i++) {
if (array[i] === item) {
array.splice(array.indexOf(item), 1);
}
}
return array;
}
console.log(removeAll(nums, 90));