'Why is my answer in the compiler not the same, with the answer from leetcode compiler? [closed]

I have a simple code, its essence is to remove duplicate numbers from a sheet. But on my server, the data received does not match the data on leetcode. For what reason could this be?

var deleteDuplicates = (head) => {
    for(let i = 0; i < head.length; i++) {
        for(let a = i + 1; a < head.length; a++) {
            if(head[i] === head[a] ) {
                head.splice([a], 1)
            } 
        }
    } 
    return head;
};
console.log(deleteDuplicates([1,1,2])); 

Output: [1,2]

Leetcode: Your input [1,1,2] Output [1,1,2] Expected [1,2]



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source