Remove duplicate element pairs from multidimensional array
I have an array that looks like this: 1. coordinates = [ [16.343345, 35.123523], 2. [14.325423, 34.632723], 3. [15.231512, 35.426914], 4. [16.343345, 35.123523], 5. [15.231512, 32.426914] ] The latitude on line 5 is the same as on line 3, but they have different longitudes and are therefore not duplicates. Both the latitude and longitude are the same on line 3 and 6, and are therefore duplicates and one should be removed. The difficulty in this question that different arrays never compare equal even if they contain same values. Therefore direct comparison methods, like indexOf won't work. The