I have tried this solution on my machine and the test cases passed successfully. But on the leetcode while submitting it throws error.
Even on the playground the solution worked https://leetcode.com/playground/K3tPYPPu
var removeDuplicates = function(nums) {
let inputNums = [];
for(let i=0; i<nums.length;i++){
if(!inputNums.indexOf(nums[i]) === -1){
inputNums.push(nums[i]);
}
}
console.log(inputNums);
return inputNums.length;
};