How to find duplicates in a multidimensional JavaScript array

advertisements

This question already has an answer here:

  • Remove duplicate element pairs from multidimensional array 7 answers

I have an array as follows

var myArry = [[1,2], [1,1], [2,0], [1,2], [1,1]]

In this array i want find the duplicates as [1,1], [1,2] which are repeated. So how to do this in jquery/javascript.


Loop through the array, compare the first and second values to every subsequent array entry.

If matching, store 1 copy of the match in a new array and return this as the result after the loop.

Sorry for no code, but this is pretty self-explanatory.