var removeDuplicates = function(nums) {
for(let i=0; i<nums.length; i++){
for(let j=i+1; j<nums.length; j++){
if(nums[i]===nums[j]){
nums.splice(i,1);
}
}
}
};
this is my code for removing the duplicates, it works for number that are repeated twice but does not work for number that is repeated more than 2. Can anyone please tell me what is wrong here? I want to solve this by only using for loops. Input: 0,0,1,1,1,2,2,3,3,4 Output: 0,1,1,2,3,4 Expected: 0,1,2,3,4