I am trying to delete all the zeros in the array nums but for some reason the splice() method ignores one of the zeros. Can you tell me what the reason is?
var deleteZeroes = function(nums) {
for(var i=0 ; i<nums.length ; i++)
{
if(nums[i]===0)
{
nums.splice(i,1)
}
}
return nums
};
deleteZeroes([0,0,4,0,3])