https://leetcode.com/problems/remove-duplicates-from-sorted-array/

1
2
3
4
5
6
7
8
9
var removeDuplicates = function(nums) {
for (i = 0; i < nums.length; i++) {
//Next number is identical to current one
if (nums[i] == nums[i+1]) {
nums.splice(i, 1);
i--;
}
}
};